/* ===========================
   LISTING PAGE STYLES
   =========================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===========================
   PAGE LAYOUT
   =========================== */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
  width: 100%;
  position: relative;
}

/* ===========================
   BREADCRUMB
   =========================== */
.breadcrumb {
  padding: 20px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  color: var(--border-strong);
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

/* ===========================
   HERO SECTION
   =========================== */
.hero {
  padding: 24px 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.hero-content {
  max-width: 600px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 36px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.hero-stats {
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===========================
   NAV ACTIVE STATES
   =========================== */
.nav-dropdown-trigger.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-dropdown-menu a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ===========================
   STICKY CONTROLS WRAPPER
   =========================== */
.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  margin-bottom: 0;
  padding-top: 0;
}

/* ===========================
   ACTIONS BAR
   =========================== */
.actions-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  min-height: 72px;
  box-sizing: border-box;
  background: rgba(250, 251, 252, 1);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.actions-bar.scrolled {
  border-bottom-color: var(--border);
}

.search-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

#search {
  width: 280px;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

#search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 115, 0, 0.1);
}

#search::placeholder {
  color: var(--muted);
}

#sort-select {
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #fff;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s ease;
}

#sort-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 115, 0, 0.1);
}

/* Toggle Switch */
.toggle-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-container input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #e2e8f0;
  border-radius: 12px;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: white;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider {
  background-color: #10b981;
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

.compare-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.compare-button svg {
  width: 18px;
  height: 18px;
}

.compare-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 115, 0, 0.3);
}

.compare-button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.compare-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===========================
   TABLE STRUCTURE
   =========================== */
.table-header-container {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin: 0;
  width: 100%;
}

.table-header-inner {
  overflow-x: hidden;
  overflow-y: hidden;
  border-bottom: 1px solid var(--border);
}

.table-wrapper {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
}

.table-body-container {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}

.models-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}

/* ===========================
   TABLE COLUMNS
   =========================== */
.col-compare {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

.col-model {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
}

.col-provider {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
}

.col-context-length {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
}

.col-open-weight {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
}

.col-input-price,
.col-output-price,
.col-image-generation,
.col-video-generation {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}

/* ===========================
   TABLE HEADER
   =========================== */
.models-table thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fafbfc;
}

/* ===========================
   STICKY COLUMNS
   =========================== */
.header-table .col-compare,
.body-table .col-compare,
.alias-row td.col-compare {
  position: sticky !important;
  left: 0 !important;
  z-index: 50;
  background: #fff;
}

.header-table .col-compare {
  background: #fafbfc;
  z-index: 150;
}

.header-table .col-model,
.body-table .col-model,
.alias-row td.col-model {
  position: sticky !important;
  left: 80px !important;
  background: #fff;
  z-index: 50;
}

.header-table .col-model {
  background: #fafbfc;
  z-index: 150;
}

.body-table .col-model::after,
.header-table .col-model::after,
.alias-row td.col-model::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
  pointer-events: none;
}

/* ===========================
   TABLE ROWS
   =========================== */
.alias-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.alias-row:last-of-type {
  border-bottom: none;
}

.alias-row td {
  padding: 14px 16px;
  vertical-align: middle;
}

.alias-row:hover {
  background: #f8fafc;
}

.alias-row:hover .col-model,
.alias-row:hover .col-compare {
  background: #f8fafc !important;
}

/* ===========================
   TABLE CONTENT
   =========================== */
.model-name {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.model-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f9;
}

.model-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.provider-badge {
  display: inline-block;
  padding: 4px 10px;
  background: #f1f5f9;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.provider-badge:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.context-length-value,
.price-value,
.info-value,
.image-generation-value,
.open-weight-value {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}

.open-weight-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.open-weight-badge.yes {
  background: #dcfce7;
  color: #166534;
}

.open-weight-badge.no {
  background: #fee2e2;
  color: #991b1b;
}

/* ===========================
   PRICE LIST STYLING
   =========================== */
.price-container {
  display: flex;
  flex-direction: column;
}

.price-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: baseline;
}

.price-row {
  display: contents;
}

.price-label {
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
  font-size: 13px;
}

.price-amount {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.price-nested {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 6px;
  align-items: baseline;
}

.price-nested-row {
  display: contents;
}

.price-nested-label {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.price-nested-value {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* ===========================
   SCROLLBAR STYLING
   =========================== */
.table-body-container::-webkit-scrollbar {
  height: 8px;
}

.table-body-container::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.table-body-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-body-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-header-container::-webkit-scrollbar {
  display: none;
}

.table-header-container {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* ===========================
   RESPONSIVE: TABLETS
   =========================== */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding: 24px 0;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-stats {
    gap: 24px;
  }

  .stat-value {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 0 16px 32px;
  }

  .breadcrumb {
    padding: 16px 0;
    font-size: 13px;
  }

  .hero {
    padding: 16px 0 32px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .sticky-controls {
    top: 56px;
    background: #fafbfc;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
    z-index: 500;
  }
  
  .sticky-controls::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 0;
    right: 0;
    height: 100px;
    background: #fafbfc;
    z-index: -1;
  }

  .actions-bar {
    height: auto;
    min-height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0;
    background: transparent;
    margin: 0;
  }

  .search-group {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  #search {
    width: 100%;
    padding: 12px 12px 12px 40px;
  }

  #sort-select {
    width: 100%;
    padding: 12px 32px 12px 12px;
  }

  .toggle-container {
    width: 100%;
    justify-content: space-between;
    padding: 8px 0;
  }

  .toggle-label {
    font-size: 13px;
  }

  .compare-button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 12px 20px;
  }

  .table-header-container {
    margin: 0;
    width: 100%;
    background: transparent;
    overflow: visible;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  
  .table-header-inner {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    background: #fff;
    border: 1px solid var(--border);
    border-bottom: none;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
  
  .table-header-inner .models-table {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
  
  .table-header-inner .models-table thead th:first-child {
    border-top-left-radius: 11px;
  }
  
  .table-header-inner .models-table thead th:last-child {
    border-top-right-radius: 11px;
  }
  
  .table-wrapper {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  
  .table-wrapper {
    border-radius: 0 0 12px 12px;
  }

  .models-table thead th {
    padding: 12px 8px;
    font-size: 10px;
  }

  .alias-row td {
    padding: 12px 8px;
  }

  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .model-name {
    font-size: 13px;
  }

  .model-icon,
  .model-icon img {
    width: 24px;
    height: 24px;
  }
}

/* ===========================
   RESPONSIVE: MOBILE
   =========================== */
@media (max-width: 520px) {
  .page {
    padding: 0 12px 24px;
  }

  .breadcrumb {
    padding: 12px 0;
    font-size: 12px;
  }

  .hero {
    padding: 12px 0 24px;
    margin-bottom: 20px;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .hero-stats {
    gap: 20px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 10px;
  }

  .col-model {
    min-width: 180px;
    max-width: 180px;
    width: 180px;
  }

  .models-table thead th {
    padding: 10px 8px;
  }

  .alias-row td {
    padding: 10px 8px;
  }

  .model-icon,
  .model-icon img {
    width: 22px;
    height: 22px;
  }

  .model-name {
    font-size: 12px;
    gap: 8px;
  }
}

/* ===========================
   MB CERTIFIED BADGE
   =========================== */
.mb-certified-wrapper {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
}

.mb-certified-badge {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .mb-certified-wrapper {
    margin-left: 4px;
  }
  
  .mb-certified-badge {
    width: 14px;
    height: 14px;
  }
}
