/* ===== Onboarding CTA pulse ===== */
@keyframes onboard-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.5), 0 10px 15px -3px rgba(20, 184, 166, 0.2); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(13, 148, 136, 0), 0 10px 25px -3px rgba(20, 184, 166, 0.35); transform: scale(1.05); }
}

/* ===== Base & Reset ===== */
body {
  background-color: #f0f4f8;
  color: #1f2937;
}

/* ===== Glassmorphism ===== */
.glass-panel {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ===== Aurora Gradient Text ===== */
.aurora-text {
  background: linear-gradient(to right, #0d9488, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Bounce delay helpers ===== */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }

/* ===== Recording Visualizer Bars ===== */
.visualizer-bar {
  animation: bounce 1s infinite;
}

/* ===== Audio Waveform Bars ===== */
.waveform-bar {
  transition: background-color 0.3s;
}

/* ===== Page Transitions ===== */
#main-content {
  /* Snappy view transitions: 0.15s (was 0.3s) — halves the per-navigation
     fade time. Paired with the ~120ms content-swap delay in App.navigate. */
  transition: opacity 0.15s ease, transform 0.15s ease;
}
#main-content.view-exit {
  opacity: 0;
  transform: translateY(-8px);
}
#main-content.view-enter {
  opacity: 0;
  transform: translateY(12px);
}

/* ===== AI Sidebar layout ===== */
@media (min-width: 1024px) {
  .ai-sidebar-open #main-content {
    padding-right: 480px;
    transition: padding-right 0.3s ease;
  }
}
@media (max-width: 1023px) {
  .ai-sidebar-open #main-content {
    padding-bottom: 60px;
  }
}

/* ===== Scrollbar styling ===== */
.overflow-y-auto::-webkit-scrollbar {
  width: 6px;
}
.overflow-y-auto::-webkit-scrollbar-track {
  background: transparent;
}
.overflow-y-auto::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ===== AI Markdown in chat bubbles ===== */
.ai-markdown p { margin-bottom: 0.4em; }
.ai-markdown p:last-child { margin-bottom: 0; }
.ai-markdown ul, .ai-markdown ol { margin: 0.3em 0; padding-left: 1.4em; }
.ai-markdown li { margin-bottom: 0.15em; }
.ai-markdown li::marker { color: #94a3b8; }
.ai-markdown strong { font-weight: 600; color: #334155; }
.ai-markdown em { font-style: italic; }
.ai-markdown h1, .ai-markdown h2, .ai-markdown h3 { font-weight: 600; margin: 0.5em 0 0.25em; color: #1e293b; }
.ai-markdown h1 { font-size: 1.1em; }
.ai-markdown h2 { font-size: 1.05em; }
.ai-markdown h3 { font-size: 1em; }
.ai-markdown code { background: #f1f5f9; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; color: #0d9488; }
.ai-markdown pre { background: #1e293b; color: #e2e8f0; padding: 0.75em 1em; border-radius: 8px; overflow-x: auto; margin: 0.4em 0; font-size: 0.85em; }
.ai-markdown pre code { background: none; padding: 0; color: inherit; }
.ai-markdown blockquote { border-left: 3px solid #0d9488; padding-left: 0.75em; margin: 0.4em 0; color: #64748b; font-style: italic; }
.ai-markdown hr { border: none; border-top: 1px solid #e2e8f0; margin: 0.5em 0; }
.ai-markdown a { color: #0d9488; text-decoration: underline; }
.ai-markdown table { border-collapse: collapse; width: 100%; margin: 0.4em 0; font-size: 0.9em; }
.ai-markdown th, .ai-markdown td { border: 1px solid #e2e8f0; padding: 0.3em 0.6em; text-align: left; }
.ai-markdown th { background: #f8fafc; font-weight: 600; }

/* ===== Native <select> styling ===== */
/* Replaces the platform-default arrow with a custom chevron so the trigger
   stays inside the rounded button. Auto-applies to every styled <select>
   in the app (rounded-xl is our marker class) plus the explicit opt-in. */
select.rounded-xl,
.select-styled {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 12px 12px;
  padding-right: 1.85rem;
}
select.rounded-xl::-ms-expand,
.select-styled::-ms-expand { display: none; }

/* ===== PWA safe-area insets (iOS notch / home indicator) ===== */
/* index.html sets viewport-fit=cover, so fixed top/bottom chrome must respect
   the device safe areas in standalone mode or it slides under the notch. */
@supports (padding: env(safe-area-inset-top)) {
  #navbar { padding-top: calc(1rem + env(safe-area-inset-top)); }
  #pwa-install-btn { margin-bottom: env(safe-area-inset-bottom); }
}

/* ===== Responsive admin tables (VETAI-170) ===== */
/* Wide admin tables (users, sessions, audit, nomenclature) are unreadable on a
   phone — horizontal scrolling to reach the Actions column is painful. Below
   the Tailwind `md` breakpoint (768px) a `.resp-table` reflows each row into a
   stacked label/value card; the column header for each cell comes from its
   `data-label` attribute. At >=768px nothing changes — the real table renders
   exactly as before, so desktop/tablet-landscape are untouched. */
@media (max-width: 767.98px) {
  table.resp-table thead {
    /* Visually hidden, kept for a11y/semantics. */
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  table.resp-table,
  table.resp-table tbody,
  table.resp-table tr,
  table.resp-table td {
    display: block;
    width: 100%;
  }
  table.resp-table tr {
    border: 1px solid rgb(226 232 240);   /* slate-200 */
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.625rem;
    padding: 0.25rem 0.875rem;
  }
  table.resp-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: right;
    border: 0 !important;
    padding: 0.5rem 0;
  }
  /* Label from the cell's data-label; rows with no label (e.g. action-only
     cells) skip the label and let the content take the full width. */
  table.resp-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 38%;
    text-align: left;
    font-weight: 600;
    color: rgb(100 116 139);              /* slate-500 */
  }
  table.resp-table td[data-label=""]::before { content: none; }
  /* Action cells: let buttons sit on their own line, left-aligned. */
  table.resp-table td.resp-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-top: 1px solid rgb(241 245 249) !important;  /* slate-100 */
    margin-top: 0.25rem;
    padding-top: 0.625rem;
  }
}
