/* ============================================================
   TokenPrice — Global Stylesheet
   Mobile-first, system fonts, no external dependencies
   ============================================================ */

/* ------------------------------------------------------------
   Variables
   ------------------------------------------------------------ */
:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #eef2ff;
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;

  /* Provider accent colours */
  --anthropic: #c84b31;
  --openai:    #10a37f;
  --google:    #4285f4;
  --mistral:   #ff7000;
  --deepseek:  #1e40af;
  --xai:       #111827;
  --cohere:    #39c5bb;

  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
}

/* ------------------------------------------------------------
   Reset
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

/* ------------------------------------------------------------
   Header / Nav
   ------------------------------------------------------------ */
.site-header {
  background: #0f172a;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
}

.nav-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.nav-logo span { color: var(--primary); }

.nav-links {
  display: none;
  gap: .25rem;
  margin-left: .5rem;
}
@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-links a {
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  padding: .35rem .65rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.08);
  text-decoration: none;
}

/* push lang switcher to the right */
.nav-spacer { flex: 1; }

.lang-switcher {
  display: flex;
  gap: 2px;
}
.lang-switcher a {
  color: rgba(255,255,255,.55);
  font-size: .75rem;
  font-weight: 600;
  padding: .3rem .5rem;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color .15s, background .15s;
}
.lang-switcher a:hover,
.lang-switcher a.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  text-decoration: none;
}

/* Mobile menu toggle — visible only on small screens */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  padding: .4rem;
  border-radius: 6px;
}
@media (min-width: 768px) { .nav-toggle { display: none; } }

.nav-mobile {
  display: none;
  flex-direction: column;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .5rem 1rem 1rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  padding: .6rem .5rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-mobile a:last-child { border: none; }
.nav-mobile a:hover { color: #fff; text-decoration: none; }

/* ------------------------------------------------------------
   Sections
   ------------------------------------------------------------ */
.section {
  padding: 3rem 0;
}
.section + .section {
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.section-link {
  font-size: .875rem;
  color: var(--primary);
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  padding: 4rem 0 3.5rem;
  color: #fff;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(79,70,229,.25);
  border: 1px solid rgba(99,102,241,.4);
  color: #a5b4fc;
  font-size: .75rem;
  font-weight: 600;
  padding: .3rem .75rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
  max-width: 700px;
}

.hero-sub {
  font-size: 1.0625rem;
  color: rgba(255,255,255,.7);
  max-width: 560px;
  margin-bottom: 2rem;
  line-height: 1.65;
}

.hero-ctas {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.hero-updated {
  margin-top: 2.5rem;
  font-size: .8125rem;
  color: rgba(255,255,255,.4);
}

/* ------------------------------------------------------------
   Overview chart — provider chips + price-type toggle
   ------------------------------------------------------------ */
.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.provider-chips {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

.provider-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .3rem .7rem;
  border-radius: 100px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  background: #f1f5f9;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}
.provider-chip:hover { filter: brightness(.95); }
.provider-chip.active {
  color: #fff;
  border-color: transparent;
}
/* dot indicator */
.provider-chip::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}
.provider-chip.active::before { opacity: 1; background: rgba(255,255,255,.9); }

.price-type-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
}
.price-type-btn {
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem .75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.price-type-btn.active {
  background: var(--primary);
  color: #fff;
}
.price-type-btn:hover:not(.active) { background: var(--border); }

.overview-chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.overview-chart-wrapper canvas { max-height: 300px; }

.bar-chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem .75rem;
}
.bar-chart-wrapper canvas { max-height: 220px; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.25);
}
.btn-outline:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.45);
}

.btn-sm {
  font-size: .8125rem;
  padding: .4rem .9rem;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ------------------------------------------------------------
   Provider badge
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 4px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.badge-anthropic { background: var(--anthropic); }
.badge-openai    { background: var(--openai); }
.badge-google    { background: var(--google); }
.badge-mistral   { background: var(--mistral); }
.badge-deepseek  { background: var(--deepseek); }
.badge-xai       { background: var(--xai); }

/* ------------------------------------------------------------
   Prices Table
   ------------------------------------------------------------ */
.prices-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.prices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--surface);
}

.prices-table th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .75rem 1rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.prices-table th:first-child,
.prices-table th:nth-child(2) { text-align: left; }

.prices-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.prices-table td:first-child,
.prices-table td:nth-child(2) { text-align: left; }

.prices-table tr:last-child td { border-bottom: none; }
.prices-table tbody tr:hover { background: #f8fafc; }

.prices-table .price-value { font-family: var(--font-mono); font-size: .825rem; }
.prices-table .price-na    { color: var(--text-muted); }
.prices-table .model-name  { font-weight: 500; }
.prices-table .context-val { color: var(--text-muted); font-size: .8rem; }

/* ------------------------------------------------------------
   Chart
   ------------------------------------------------------------ */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.chart-select {
  font-family: var(--font);
  font-size: .875rem;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 220px;
}
.chart-select:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

.chart-wrapper {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.chart-wrapper canvas { max-height: 320px; }

.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ------------------------------------------------------------
   Announcements
   ------------------------------------------------------------ */
.announcements-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.announcement-item {
  display: flex;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.announcement-date {
  flex-shrink: 0;
  min-width: 80px;
  font-size: .75rem;
  color: var(--text-muted);
  padding-top: .15rem;
}

.announcement-body {}

.announcement-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .25rem;
}

.announcement-desc {
  font-size: .8375rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ------------------------------------------------------------
   News Grid
   ------------------------------------------------------------ */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px)  { .news-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .news-grid { grid-template-columns: repeat(3, 1fr); } }

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: box-shadow .15s, transform .15s;
}
.news-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.news-source {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .5rem;
  border-radius: 4px;
  align-self: flex-start;
  color: #fff;
}
.news-source-techcrunch  { background: #00a84f; }
.news-source-venturebeat { background: #1975d1; }
.news-source-huggingface { background: #ff9d00; color: #000; }
.news-source-default     { background: var(--text-muted); }

.news-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  flex: 1;
}

.news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.news-date {
  font-size: .75rem;
  color: var(--text-muted);
}

.news-link {
  font-size: .775rem;
  font-weight: 600;
  color: var(--primary);
}

/* ------------------------------------------------------------
   Feature cards (homepage highlights)
   ------------------------------------------------------------ */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (min-width: 640px)  { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.375rem;
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: .75rem;
}

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .35rem;
}

.feature-desc {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ------------------------------------------------------------
   Loading / Error states
   ------------------------------------------------------------ */
.state-loading,
.state-error {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}
.state-error { color: var(--danger); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: .5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
  background: #0f172a;
  color: rgba(255,255,255,.5);
  padding: 2rem 0;
  margin-top: 2rem;
  font-size: .875rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  align-items: flex-start;
}
@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-brand {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}
.footer-brand span { color: var(--primary); }

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: rgba(255,255,255,.5);
  font-size: .8125rem;
  transition: color .15s;
}
.footer-links a:hover { color: #fff; text-decoration: none; }

.footer-updated {
  font-size: .75rem;
  color: rgba(255,255,255,.35);
}

/* ------------------------------------------------------------
   Forms (alerts page)
   ------------------------------------------------------------ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.form-input,
.form-select {
  font-family: var(--font);
  font-size: .9rem;
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-hint {
  font-size: .8rem;
  color: var(--text-muted);
}

.form-gdpr {
  font-size: .8125rem;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.form-message {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  display: none;
}
.form-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  display: block;
}
.form-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  display: block;
}

/* ------------------------------------------------------------
   Comparator table (comparateur.html)
   ------------------------------------------------------------ */
.comparator-controls {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}

.comparator-search {
  flex: 1;
  min-width: 180px;
}

/* ------------------------------------------------------------
   Calculator (calculateur.html)
   ------------------------------------------------------------ */
.calculator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 768px) {
  .calculator-layout { grid-template-columns: 1fr 1fr; }
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.result-item.highlighted {
  border-color: var(--primary);
  background: var(--primary-light);
}

.result-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.result-value {
  font-size: 1.375rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}
.result-item.highlighted .result-value { color: var(--primary-dark); }

/* ------------------------------------------------------------
   Score page
   ------------------------------------------------------------ */
.score-chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.score-chart-wrapper canvas { max-height: 380px; }

/* ------------------------------------------------------------
   Legal page
   ------------------------------------------------------------ */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
}
.legal-content h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 2rem 0 .75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.legal-content h2:first-of-type { border-top: none; }
.legal-content p { margin-bottom: .85rem; color: var(--text-muted); line-height: 1.7; font-size: .9375rem; }
.legal-content ul { padding-left: 1.5rem; margin-bottom: .85rem; }
.legal-content li { color: var(--text-muted); font-size: .9375rem; line-height: 1.7; margin-bottom: .3rem; }

/* ------------------------------------------------------------
   Utilities
   ------------------------------------------------------------ */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.mt-1  { margin-top: .25rem; }
.mt-2  { margin-top: .5rem; }
.mt-4  { margin-top: 1rem; }
.hidden { display: none !important; }
