/* =========================================================
   AI Models Directory — ai-models-page.css
   Professional directory layout: hero → sidebar filters + table
   ========================================================= */

/* ---- Design tokens ---- */
.aim {
  --aim-brand: #0b66ff;
  --aim-brand-hover: #0952d4;
  --aim-text: #0f172a;
  --aim-muted: #64748b;
  --aim-border: rgba(15, 23, 42, 0.10);
  --aim-bg: #f8fafc;
  --aim-card: #ffffff;
  --aim-radius: 12px;
  --aim-radius-sm: 8px;
  --aim-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --aim-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --aim-transition: 150ms ease;
  padding-bottom: 3rem;
}

/* ---- HERO ---- */
.aim-hero {
  background: linear-gradient(168deg, #020617 0%, #0f172a 52%, #1e293b 100%);
  padding: 2.2rem 0 2.8rem;
  color: #fff;
}

.aim-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
}

.aim-breadcrumb li + li::before {
  content: "/";
  margin-right: 0.35rem;
  opacity: 0.4;
}

.aim-breadcrumb a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
}

.aim-breadcrumb a:hover {
  color: #fff;
}

.aim-hero-inner {
  margin-top: 1.6rem;
  text-align: center;
}

.aim-hero-text h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
}

.aim-hero-text h1 em {
  font-style: normal;
  color: var(--aim-brand);
}

.aim-hero-sub {
  margin: 0.7rem auto 0;
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
}

/* Hero search */
.aim-hero-search {
  position: relative;
  margin-top: 1.5rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.aim-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--aim-muted);
  pointer-events: none;
}

.aim-hero-search input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 2.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  transition: border-color var(--aim-transition), background var(--aim-transition);
}

.aim-hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.aim-hero-search input:focus {
  outline: none;
  border-color: var(--aim-brand);
  background: rgba(255, 255, 255, 0.12);
}

/* Hero stats */
.aim-hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.6rem;
}

.aim-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.aim-stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.aim-stat--date .aim-stat-num {
  font-size: 1rem;
  font-weight: 700;
}

.aim-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.15rem;
}

/* ---- BODY LAYOUT: sidebar + main ---- */
.aim-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  align-items: start;
}

/* ---- SIDEBAR FILTERS ---- */
.aim-filters {
  position: sticky;
  top: 80px;
  padding: 1rem;
  background: var(--aim-card);
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  box-shadow: var(--aim-shadow);
}

.aim-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.aim-filters-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--aim-text);
}

.aim-filters-clear {
  background: none;
  border: none;
  padding: 0;
  color: var(--aim-brand);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.aim-filters-clear:hover {
  text-decoration: underline;
}

.aim-filter-group {
  border: none;
  margin: 0;
  padding: 0.7rem 0 0;
  border-top: 1px solid var(--aim-border);
}

.aim-filter-group:first-of-type {
  border-top: none;
  padding-top: 0;
}

.aim-filter-group legend {
  padding: 0;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--aim-text);
}

.aim-filter-group select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius-sm);
  background: var(--aim-card);
  font: inherit;
  font-size: 0.88rem;
  color: var(--aim-text);
  cursor: pointer;
}

.aim-filter-group select:focus {
  outline: 2px solid var(--aim-brand);
  outline-offset: -1px;
}

/* Modality checkboxes */
.aim-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.aim-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--aim-text);
  user-select: none;
}

.aim-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--aim-brand);
  cursor: pointer;
  border-radius: 3px;
}

.aim-checkbox span {
  text-transform: capitalize;
}

/* ---- RESULTS ---- */
.aim-results {
  min-width: 0;
}

/* Provider bar */
.aim-provider-bar {
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.aim-provider-bar-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scrollbar-width: thin;
}

.aim-pbadge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border: 1px solid var(--aim-border);
  border-radius: 999px;
  background: var(--aim-card);
  cursor: pointer;
  transition: border-color var(--aim-transition), box-shadow var(--aim-transition);
  appearance: none;
}

.aim-pbadge:hover,
.aim-pbadge:focus-visible {
  border-color: var(--aim-brand);
  box-shadow: 0 0 0 3px rgba(11, 102, 255, 0.12);
}

.aim-pbadge-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
  background: #fff;
}

.aim-pbadge-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--aim-text);
  white-space: nowrap;
}

/* Status bar */
.aim-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.aim-count {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--aim-muted);
}

.aim-mobile-filter-toggle {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius-sm);
  background: var(--aim-card);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--aim-text);
  cursor: pointer;
}

/* Empty state */
.aim-empty {
  padding: 2rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: var(--aim-card);
  text-align: center;
}

.aim-empty h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.aim-empty p {
  margin: 0;
  color: var(--aim-muted);
}

/* ---- TABLE ---- */
.aim-table-wrap {
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: var(--aim-card);
  box-shadow: var(--aim-shadow);
  overflow: auto;
}

.aim-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.aim-table th,
.aim-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--aim-border);
  text-align: left;
  vertical-align: middle;
}

.aim-table tbody tr:last-child td {
  border-bottom: none;
}

.aim-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--aim-muted);
  white-space: nowrap;
}

.aim-th-num,
.aim-td-num {
  text-align: right;
}

.aim-table tbody tr {
  transition: background var(--aim-transition);
}

.aim-table tbody tr:hover {
  background: rgba(11, 102, 255, 0.03);
}

.aim-provider-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.aim-fav {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
  flex-shrink: 0;
}

.aim-cell-main {
  display: block;
  font-weight: 700;
  color: var(--aim-text);
  line-height: 1.35;
}

.aim-cell-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--aim-muted);
  line-height: 1.35;
}

.aim-cell-tags {
  font-size: 0.84rem;
  color: var(--aim-muted);
}

.aim-mono {
  font-family: 'SF Mono', Consolas, 'Courier New', monospace;
  font-size: 0.84rem;
}

/* ---- PROVIDER MODAL ---- */
.aim-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1100;
  padding: 1.5rem;
}

.aim-modal[hidden],
.aim-detail-bank[hidden] {
  display: none;
}

.aim-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(6px);
}

.aim-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(800px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  overflow: auto;
  padding: 1.5rem;
  border-radius: 16px;
  background: var(--aim-card);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.32);
}

.aim-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--aim-border);
  border-radius: 999px;
  background: var(--aim-card);
  color: var(--aim-text);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.aim-modal-close:hover {
  background: #f1f5f9;
}

/* Detail panel (inside modal) */
.aim-detail-head {
  display: flex;
  align-items: start;
  gap: 0.85rem;
}

.aim-detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.aim-detail-title {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.aim-detail-sum {
  margin: 0.3rem 0 0;
  color: var(--aim-muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.aim-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

.aim-detail-stat {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.85rem;
  border-radius: var(--aim-radius-sm);
  background: #f1f5f9;
  min-width: 100px;
}

.aim-detail-stat-val {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--aim-text);
}

.aim-detail-stat-lbl {
  font-size: 0.74rem;
  color: var(--aim-muted);
  margin-top: 0.1rem;
}

/* Tabs */
.aim-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--aim-border);
  margin-bottom: 0.8rem;
}

.aim-tab {
  padding: 0.6rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--aim-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--aim-transition), border-color var(--aim-transition);
}

.aim-tab:hover {
  color: var(--aim-text);
}

.aim-tab--active {
  color: var(--aim-brand);
  border-bottom-color: var(--aim-brand);
}

/* Detail blocks */
.aim-detail-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.aim-detail-block {
  margin-top: 0.7rem;
  padding: 0.85rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: #fafbfd;
}

.aim-detail-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.aim-detail-block p,
.aim-faq-pair p,
.aim-dl dd {
  margin: 0.35rem 0 0;
  color: var(--aim-muted);
  line-height: 1.65;
  font-size: 0.9rem;
}

.aim-muted {
  color: var(--aim-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.aim-dl {
  margin: 0;
}

.aim-dl div {
  padding: 0.5rem 0;
  border-top: 1px solid var(--aim-border);
}

.aim-dl div:first-child {
  border-top: none;
  padding-top: 0;
}

.aim-dl dt {
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--aim-text);
}

.aim-dl dd {
  margin: 0;
}

/* Chips */
.aim-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.aim-chip {
  display: inline-flex;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(11, 102, 255, 0.08);
  border: 1px solid rgba(11, 102, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--aim-brand);
}

.aim-chip--muted {
  background: #f1f5f9;
  border-color: var(--aim-border);
  color: var(--aim-muted);
}

/* Flagship list */
.aim-flagship-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.aim-flagship-list li {
  padding: 0.45rem 0.65rem;
  border-radius: var(--aim-radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--aim-border);
}

.aim-flagship-list code {
  font-family: 'SF Mono', Consolas, 'Courier New', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--aim-text);
}

/* FAQ inside modal */
.aim-faq-list {
  display: grid;
  gap: 0.6rem;
}

.aim-faq-pair h4 {
  margin: 0;
  font-size: 0.92rem;
}

/* Links row in modal */
.aim-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--aim-border);
}

.aim-detail-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--aim-border);
  color: var(--aim-brand);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--aim-transition);
}

.aim-detail-links a:hover {
  background: #e2e8f0;
}

.aim-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--aim-brand);
  border: none;
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--aim-transition);
}

.aim-btn-primary:hover {
  background: var(--aim-brand-hover);
}

/* ---- EDITORIAL SECTIONS ---- */

/* Prose */
.aim-prose {
  margin-top: 3rem;
}

.aim-prose h2 {
  margin: 0 0 0.7rem;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.aim-prose p {
  margin: 0 0 0.8rem;
  max-width: 76ch;
  color: var(--aim-muted);
  line-height: 1.75;
}

.aim-prose p:last-child {
  margin-bottom: 0;
}

/* Steps */
.aim-steps-section {
  margin-top: 3rem;
}

.aim-steps-section h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.aim-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.aim-step {
  padding: 1.2rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: var(--aim-card);
  box-shadow: var(--aim-shadow);
}

.aim-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--aim-brand);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.aim-step h3 {
  margin: 0.5rem 0 0.3rem;
  font-size: 0.98rem;
}

.aim-step p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--aim-muted);
  line-height: 1.65;
}

/* Glossary */
.aim-glossary {
  margin-top: 3rem;
}

.aim-glossary h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.aim-glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.aim-glossary-card {
  padding: 1.1rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: var(--aim-card);
  box-shadow: var(--aim-shadow);
}

.aim-glossary-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  color: var(--aim-brand);
}

.aim-glossary-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--aim-muted);
  line-height: 1.65;
}

/* FAQ — collapsible details */
.aim-faq {
  margin-top: 3rem;
}

.aim-faq h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.aim-faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.aim-faq-item {
  border-bottom: 1px solid var(--aim-border);
}

.aim-faq-item:first-child {
  border-top: 1px solid var(--aim-border);
}

.aim-faq-item summary {
  padding: 0.9rem 0;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--aim-text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.aim-faq-item summary::-webkit-details-marker {
  display: none;
}

.aim-faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--aim-muted);
  transition: transform var(--aim-transition);
}

.aim-faq-item[open] summary::after {
  content: "\2212";
}

.aim-faq-item p {
  margin: 0 0 0.9rem;
  color: var(--aim-muted);
  line-height: 1.72;
  font-size: 0.92rem;
  max-width: 76ch;
}

.aim-faq-item a {
  color: var(--aim-brand);
  text-decoration: none;
  font-weight: 600;
}

.aim-faq-item a:hover {
  text-decoration: underline;
}

/* Unavailable state */
.aim-unavailable {
  margin-top: 3rem;
  padding: 2rem;
  border: 1px solid var(--aim-border);
  border-radius: var(--aim-radius);
  background: var(--aim-card);
  text-align: center;
}

.aim-unavailable h2 {
  margin: 0 0 0.4rem;
}

.aim-unavailable p {
  margin: 0;
  color: var(--aim-muted);
}

/* ---- RESPONSIVE ---- */

@media (max-width: 1100px) {
  .aim-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .aim-glossary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .aim-body {
    grid-template-columns: 1fr;
  }

  .aim-filters {
    position: static;
    display: none;
  }

  .aim-filters.aim-filters--open {
    display: block;
  }

  .aim-mobile-filter-toggle {
    display: inline-flex;
  }

  .aim-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .aim-hero {
    padding: 1.4rem 0 2rem;
  }

  .aim-hero-text h1 {
    font-size: 1.5rem;
  }

  .aim-hero-stats {
    gap: 1rem;
  }

  .aim-steps {
    grid-template-columns: 1fr;
  }

  .aim-glossary-grid {
    grid-template-columns: 1fr;
  }

  .aim-table {
    min-width: 620px;
  }

  .aim-pbadge-name {
    display: none;
  }

  .aim-pbadge {
    padding: 0.35rem;
  }

  .aim-modal {
    padding: 0.6rem;
  }

  .aim-modal-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    padding: 1rem;
    border-radius: var(--aim-radius);
  }

  .aim-detail-head {
    flex-direction: column;
  }

  .aim-detail-stats {
    flex-direction: column;
  }
}
