/* style.css — design tokens e estrutura base
   Calculadora Marketplace */

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

:root {
  --violet:        #7C3AED;
  --violet-dark:   #6D28D9;
  --violet-light:  #F5F3FF;
  --amber:         #F59E0B;
  --amber-dark:    #D97706;
  --emerald:       #10B981;
  --emerald-light: #ECFDF5;
  --rose:          #E11D48;
  --rose-light:    #FFF1F2;

  --gray-50:  #FAFAFA;
  --gray-100: #F4F4F5;
  --gray-200: #E4E4E7;
  --gray-400: #A1A1AA;
  --gray-600: #52525B;
  --gray-800: #27272A;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 4px 20px rgba(24, 16, 60, 0.08);
  --shadow-sm: 0 2px 10px rgba(24, 16, 60, 0.06);

  --bg:             var(--gray-50);
  --surface:        #FFFFFF;
  --surface-border: rgba(24, 16, 60, 0.07);
  --text:           var(--gray-800);
  --text-muted:     var(--gray-400);
  --text-secondary: var(--gray-600);
  --input-bg:       #FFFFFF;
  --input-border:   var(--gray-200);
  --divider:        var(--gray-100);
}

[data-theme="dark"] {
  --bg:             #121016;
  --surface:        #1C1A22;
  --surface-border: rgba(255,255,255,0.08);
  --text:           #F4F4F5;
  --text-muted:     rgba(255,255,255,0.40);
  --text-secondary: rgba(255,255,255,0.62);
  --input-bg:       #26232D;
  --input-border:   rgba(255,255,255,0.10);
  --divider:        rgba(255,255,255,0.07);
  --violet-light:   rgba(124,58,237,0.16);
  --emerald-light:  rgba(16,185,129,0.14);
  --rose-light:     rgba(225,29,72,0.16);
  --shadow:         0 4px 20px rgba(0,0,0,0.35);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

.app { max-width: 480px; margin: 0 auto; padding: 0 0 96px; }

a { color: inherit; text-decoration: none; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 8px;
}
.topbar .back { font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--violet); }

/* ── Hero ── */
.hero { padding: 8px 20px 18px; }
.hero h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 6px; }
.hero p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.hero .badge {
  display: inline-block; margin-top: 10px; padding: 4px 10px;
  background: var(--violet-light); color: var(--violet-dark);
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
[data-theme="dark"] .hero .badge { color: #C4B5FD; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin: 0 16px 14px;
}
.card h2 {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 14px;
}

/* ── Fields ── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px;
}
.field label .hint {
  width: 15px; height: 15px; border-radius: 50%; background: var(--gray-100);
  color: var(--text-muted); font-size: 10px; display: inline-flex; align-items: center; justify-content: center;
  cursor: help; font-weight: 700;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .prefix {
  position: absolute; left: 12px; font-size: 14.5px; color: var(--text-muted); font-weight: 600;
}
.input-wrap .suffix {
  position: absolute; right: 12px; font-size: 14.5px; color: var(--text-muted); font-weight: 600;
}
input[type="text"], input[type="number"], select {
  width: 100%; height: 46px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--input-border); background: var(--input-bg); color: var(--text);
  font-size: 15.5px; font-weight: 600; padding: 0 14px;
  transition: border-color 0.15s;
  appearance: none;
}
input[type="text"], input[type="number"] { padding-left: 30px; }
select { padding-right: 32px; }
input:focus, select:focus { outline: none; border-color: var(--violet); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: 12px;
}

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
}
.toggle-row .toggle-label { font-size: 13.5px; font-weight: 600; color: var(--text-secondary); }
.toggle-row .toggle-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--gray-200); border-radius: 999px; cursor: pointer;
  transition: background 0.2s;
}
.switch .track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--violet); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ── Mode toggle ── */
.mode-toggle {
  display: flex; background: var(--gray-100); border-radius: var(--radius-sm); padding: 3px; margin: 0 16px 14px;
}
[data-theme="dark"] .mode-toggle { background: var(--input-bg); }
.mode-toggle button {
  flex: 1; border: none; background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 700; padding: 10px; border-radius: 8px; cursor: pointer;
}
.mode-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Button ── */
.btn-primary {
  width: 100%; height: 50px; border: none; border-radius: var(--radius-sm);
  background: var(--violet); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform 0.1s, background 0.15s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { background: var(--violet-dark); }

/* ── Result ── */
.result-hero { text-align: center; padding: 6px 4px 18px; }
.result-hero .label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.result-hero .price { font-size: 34px; font-weight: 800; letter-spacing: -0.01em; margin: 4px 0; }
.result-hero .price.bad { color: var(--rose); }
.result-hero .sub { font-size: 13px; color: var(--text-secondary); }

.result-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--divider); font-size: 13.5px;
}
.result-row:last-child { border-bottom: none; }
.result-row .rk { color: var(--text-secondary); }
.result-row .rv { font-weight: 700; }
.result-row.total .rv { color: var(--emerald); font-size: 15px; }
.result-row.neg .rv { color: var(--rose); }

.tier-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--violet-light); color: var(--violet-dark);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-bottom: 12px;
}
[data-theme="dark"] .tier-badge { color: #C4B5FD; }

.feedback {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  display: none;
}
.feedback.bad { display: block; background: var(--rose-light); color: var(--rose); }
.feedback.good { display: block; background: var(--emerald-light); color: var(--emerald); }

/* ── FAQ ── */
.faq-item { border-bottom: 1px solid var(--divider); padding: 12px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.faq-q::after { content: "+"; color: var(--text-muted); font-size: 16px; font-weight: 400; }
.faq-item.open .faq-q::after { content: "−"; }
.faq-a {
  font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-top: 8px; display: none;
}
.faq-item.open .faq-a { display: block; }

/* ── Cross-links ── */
.cross-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px; border-bottom: 1px solid var(--divider); font-size: 13.5px; font-weight: 600;
}
.cross-link:last-child { border-bottom: none; }
.cross-link .arrow { color: var(--text-muted); }

/* ── Home cards ── */
.calc-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--surface-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px; margin: 0 16px 12px;
}
.calc-card .icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.calc-card .icon img { width: 100%; height: 100%; object-fit: contain; }
.calc-card .icon.icon-chip { background: #fff; border: 1px solid var(--surface-border); }
.calc-card .icon.icon-chip img { padding: 7px; }

.brand-logo {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo.icon-chip { background: #fff; border: 1px solid var(--surface-border); }
.brand-logo.icon-chip img { padding: 4px; }
.calc-card .info { flex: 1; }
.calc-card .info .name { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.calc-card .info .desc { font-size: 12px; color: var(--text-muted); }
.calc-card .arrow { color: var(--text-muted); font-size: 18px; }

/* ── Comparativo ── */
.compare-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--divider); cursor: pointer;
}
.compare-row:last-child { border-bottom: none; }
.compare-row .clogo {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.compare-row .clogo img { width: 100%; height: 100%; object-fit: contain; }
.compare-row .clogo.icon-chip { background: #fff; border: 1px solid var(--surface-border); }
.compare-row .clogo.icon-chip img { padding: 5px; }
.compare-row .cname { flex: 1; font-weight: 700; font-size: 13.5px; }
.compare-row .cprice { font-weight: 800; font-size: 15px; text-align: right; }
.compare-row .csub { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 1px; }
.compare-row.best {
  background: var(--emerald-light); border-radius: 12px; margin: 0 -8px; padding: 14px 8px;
}
.compare-row.best .cprice { color: var(--emerald); }
.best-badge {
  font-size: 10px; font-weight: 800; color: var(--emerald);
  text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px;
}

/* ── Footer ── */
footer { text-align: center; padding: 20px; font-size: 11.5px; color: var(--text-muted); }

/* ── Theme button ── */
.theme-btn {
  position: fixed; bottom: 22px; right: 20px; width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--surface-border); cursor: pointer; font-size: 19px; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); box-shadow: var(--shadow);
}

/* ── Info banner ── */
.info-banner {
  margin: 0 16px 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--violet-light); color: var(--violet-dark); font-size: 12px; line-height: 1.5;
}
[data-theme="dark"] .info-banner { color: #DDD6FE; }
