/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Accordion Styles */
.accordion-icon {
  display: inline-block;
  transition: transform 0.3s ease-in-out;
}

button[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg);
}

[data-accordion-target="content"] {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

[data-accordion-target="content"][aria-expanded="true"] {
  max-height: 1000px;
  overflow: auto;
}

/* Hide scrollbars but keep scroll behavior */
.hide-scrollbar {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

/* AI tables inside chat messages - using to override Tailwind */
.ai-table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.ai-table th,
.ai-table td {
  border: 1px solid #d1d5db;
  padding: 0.2rem 0.4rem;
  text-align: center;
  font-size: 0.78rem;
}

.ai-table thead th {
  background-color: #f3f4f6;
  font-weight: 700;
}

.ai-table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

/* Dark mode overrides for AI tables */
.dark .ai-table {
  color: #e5e7eb;
}

.dark .ai-table th,
.dark .ai-table td {
  border-color: #4b5563;
}

.dark .ai-table thead th {
  background-color: #374151;
  color: #f9fafb;
}

.dark .ai-table tbody tr:nth-child(even) {
  background-color: #1f2937;
}

/* Hide Turbo Progress Bar to maintain SPA feel without breaking Turbo Streams */
.turbo-progress-bar {
  visibility: hidden !important;
}

/* Chat message links — Tailwind v4 typography (prose) plugin isn't loaded,
   so style anchors inside message bubbles directly. */
.message a {
  color: #1d4ed8; /* blue-700 */
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.message a:hover {
  color: #1e40af; /* blue-800 */
}

.dark .message a {
  color: #93c5fd; /* blue-300 */
}

.dark .message a:hover {
  color: #bfdbfe; /* blue-200 */
}

/* Chat message tables — typography (prose) plugin isn't loaded, so style markdown
   tables inside message bubbles directly (used by the bulk-receipts results table).
   The content wrapper has overflow-x-auto, so wide tables scroll within the bubble. */
.message table {
  width: auto;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.message th,
.message td {
  border: 1px solid #bfdbfe; /* blue-200 */
  padding: 0.375rem 0.625rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.message th {
  background-color: rgba(37, 99, 235, 0.08); /* blue-600 @ 8% */
  font-weight: 600;
  text-align: center;
}

/* Per-column body alignment for the bulk-receipts summary table. The markdown
   sanitizer strips Redcarpet's per-column alignment, so it's positional CSS:
   Total (3rd) right-aligned for amounts; CAE (4th), PDF (5th) and Estado (last)
   centered. */
.message td:nth-child(3) {
  text-align: right;
}

.message td:nth-child(4),
.message td:nth-child(5),
.message td:last-child {
  text-align: center;
}

.dark .message th,
.dark .message td {
  border-color: rgba(147, 197, 253, 0.25); /* blue-300 @ 25% */
}

.dark .message th {
  background-color: rgba(96, 165, 250, 0.12); /* blue-400 @ 12% */
}

/* Guide numbered steps — Variante A. Each direct <li> gets an auto-incrementing
   numbered circle via a CSS counter, so the markup stays clean (no hardcoded
   numbers). Nested <ul>/<ol> are unaffected (the counter targets direct children
   only). Used on /guide step cards (.guide-steps on the <ol>). */
.guide-steps {
  counter-reset: step;
}

.guide-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
}

.guide-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  color: #2563eb; /* blue-600 */
  background-color: #eff6ff; /* blue-50 */
  border-radius: 9999px;
}

.dark .guide-steps > li::before {
  color: #93c5fd; /* blue-300 */
  background-color: rgba(30, 58, 138, 0.4); /* blue-900 @ 40% */
}
