:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #eef2ff;
  --accent:        #06b6d4;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --bg:            #f8fafc;
  --card:          #ffffff;
  --border:        #e2e8f0;
  --radius:        12px;
  --shadow:        0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* ── Header ── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 900px; margin: 0 auto; }
.logo { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: .4rem; }
.lang-switch { display: flex; gap: .4rem; }
.lang-switch a {
  padding: .25rem .6rem; border-radius: 6px; font-size: .82rem; font-weight: 600;
  text-decoration: none; color: var(--text-muted); border: 1px solid var(--border);
  transition: all .15s;
}
.lang-switch a:hover  { border-color: var(--primary); color: var(--primary); }
.lang-switch a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1rem; }
main { padding: 2rem 0 3rem; }

/* ── Breadcrumb ── */
.breadcrumb { font-size: .83rem; color: var(--text-muted); margin-bottom: 1.5rem; display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--border); }

/* ── Hero ── */
.hero { margin-bottom: 1.5rem; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: var(--text); line-height: 1.2; margin-bottom: .5rem; }
.hero p  { font-size: 1rem; color: var(--text-muted); max-width: 620px; }

/* ── Calculator Card ── */
.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.form-full { grid-column: 1 / -1; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }

input[type="number"], select {
  width: 100%; padding: .65rem .85rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 1rem; color: var(--text); background: var(--bg);
  transition: border-color .15s;
  appearance: none; -webkit-appearance: none;
}
input[type="number"]:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; padding-right: 2.5rem; cursor: pointer; }

.model-info { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; min-height: 1.2em; }

/* ── Results ── */
.results {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  margin-top: 1.25rem;
}
.results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1rem; }
.result-item { background: rgba(255,255,255,.15); border-radius: 8px; padding: .9rem 1rem; }
.result-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .85; margin-bottom: .3rem; }
.result-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.result-main { grid-column: 1 / -1; background: rgba(255,255,255,.2); }
.result-main .result-value { font-size: 2rem; }

.share-btn {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
  color: #fff; padding: .5rem 1.2rem; border-radius: 8px; font-size: .88rem;
  font-weight: 600; cursor: pointer; transition: background .15s;
  display: block; margin: 0 auto;
}
.share-btn:hover { background: rgba(255,255,255,.3); }

/* ── Cheapest Model Tip ── */
.tip-box {
  background: var(--primary-light); border: 1px solid #c7d2fe;
  border-radius: 8px; padding: .8rem 1rem; margin-top: 1rem;
  font-size: .88rem; color: var(--primary-dark);
}
.tip-box strong { color: var(--primary); }

/* ── Model Comparison Table ── */
.comparison-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 1rem; }
.comparison-table th { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; padding: .6rem .8rem; text-align: left; border-bottom: 2px solid #c7d2fe; }
.comparison-table td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
.comparison-table tr:hover td { background: var(--primary-light); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 20px; }
.badge-openai    { background: #dcfce7; color: #166534; }
.badge-anthropic { background: #fef3c7; color: #92400e; }
.badge-google    { background: #dbeafe; color: #1e40af; }
.badge-meta      { background: #f3e8ff; color: #6b21a8; }
.badge-deepseek  { background: #fce7f3; color: #9d174d; }

/* ── Sections ── */
.section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.section h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.section p  { color: var(--text-muted); margin-bottom: .8rem; line-height: 1.7; }
.section ul { color: var(--text-muted); padding-left: 1.2rem; }
.section ul li { margin-bottom: .4rem; line-height: 1.7; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: .6rem; }
details { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
summary { padding: .9rem 1rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; font-size: .95rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-size: 1.2rem; color: var(--primary); font-weight: 400; flex-shrink: 0; }
details[open] summary::after { content: '−'; }
details[open] summary { border-bottom: 1px solid var(--border); background: var(--primary-light); }
.faq-answer { padding: .9rem 1rem; color: var(--text-muted); line-height: 1.7; font-size: .93rem; }

/* ── Affiliate ── */
.affiliate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.affiliate-card { border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem; text-align: center; text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; }
.affiliate-card:hover { box-shadow: 0 8px 24px rgba(79,70,229,.12); transform: translateY(-2px); }
.affiliate-card .aff-name  { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.affiliate-card .aff-desc  { font-size: .82rem; color: var(--text-muted); margin-bottom: .6rem; }
.affiliate-card .aff-badge { display: inline-block; background: var(--primary); color: #fff; font-size: .78rem; font-weight: 700; padding: .25rem .7rem; border-radius: 20px; }

/* ── Footer ── */
footer { border-top: 1px solid var(--border); padding: 1.5rem 0; text-align: center; font-size: .85rem; color: var(--text-muted); }
footer a { color: var(--primary); text-decoration: none; margin: 0 .5rem; }
footer a:hover { text-decoration: underline; }

/* ── RTL Support ── */
[dir="rtl"] .header-inner { flex-direction: row-reverse; }
[dir="rtl"] .form-grid     { direction: rtl; }
[dir="rtl"] select { background-position: left .85rem center; padding-right: .85rem; padding-left: 2.5rem; }
[dir="rtl"] .breadcrumb   { flex-direction: row-reverse; }
[dir="rtl"] .section ul   { padding-left: 0; padding-right: 1.2rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .form-grid    { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .result-main  { grid-column: 1; }
  .calc-card    { padding: 1.25rem; }
  .comparison-table { font-size: .78rem; }
  .comparison-table th, .comparison-table td { padding: .45rem .5rem; }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 1.4rem; }
}
