/* ===== AI Cost Calculator v2 - Stylesheet ===== */

:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #3fb950;
  --accent-dim: #238636;
  --red: #f85149;
  --blue: #58a6ff;
  --yellow: #d29922;
  --orange: #db6d28;
  --purple: #bc8cff;
  --radius: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0d1117 0%, #161b22 100%);
}
.header h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.header p { color: var(--text-dim); font-size: .95rem; max-width: 600px; margin: 0 auto; }

/* ===== LANG SWITCHER ===== */
.lang-switch {
  display: inline-flex;
  gap: 4px;
  margin-top: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  transition: all .2s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--accent-dim); color: #fff; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: .8rem 1.2rem;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: .9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== PANES ===== */
.pane { display: none; padding: 1.5rem 1rem 3rem; max-width: 900px; margin: 0 auto; }
.pane.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SECTION TITLE ===== */
.section-title { font-size: 1.3rem; margin-bottom: .3rem; }
.section-desc { color: var(--text-dim); font-size: .9rem; margin-bottom: 1.5rem; }

/* ===== INPUT CONTROLS ===== */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.control-group label {
  display: block;
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: .3rem;
}
input[type="number"], select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .7rem;
  border-radius: var(--radius);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
input[type="number"]:focus, select:focus { border-color: var(--accent); }
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
.slider-row { display: flex; align-items: center; gap: .5rem; }
.slider-val { font-weight: 700; color: var(--accent); min-width: 28px; text-align: center; }

/* ===== COMPARE CARDS ===== */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .8rem;
  margin-bottom: 1.5rem;
}
.compare-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  position: relative;
  transition: transform .2s, border-color .2s;
}
.compare-card:hover { transform: translateY(-2px); }
.compare-card.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(63,185,80,.15); }

/* Monogram badge icon (replaces emoji) */
.b-badge-icon {
  width: 44px; height: 44px;
  margin: 0 auto .5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-dim), var(--blue));
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.5px;
}
.b-name { font-size: .85rem; font-weight: 600; }
.b-price { font-size: 1.3rem; font-weight: 800; margin: .3rem 0; }
.b-desc { font-size: .72rem; color: var(--text-dim); line-height: 1.4; }
.b-detail { font-size: .72rem; color: var(--text-dim); margin-top: .4rem; padding-top: .4rem; border-top: 1px solid var(--border); }

/* ===== BADGES ===== */
.badge {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge.best { background: var(--accent); color: #fff; }
.badge.worst { background: var(--red); color: #fff; }

/* ===== BAR CHART ===== */
.chart { margin-bottom: 1.5rem; }
.bar-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.bar-row .b-name { width: 130px; flex-shrink: 0; font-size: .8rem; }
.b-track {
  flex: 1;
  height: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.b-fill {
  height: 100%;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  transition: width .5s ease;
  min-width: 2px;
}
.b-val { width: 60px; text-align: right; font-size: .82rem; font-weight: 600; }

/* ===== SUMMARY ===== */
.summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: .88rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ===== SUBSCRIPTION LIST ===== */
.sub-search-wrap { margin-bottom: 1rem; }
.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .6rem .8rem .6rem 2.2rem;
  border-radius: var(--radius);
  font-size: .9rem;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .7rem center;
}
.search-input:focus { border-color: var(--accent); }

.cat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  margin: 1rem 0 .4rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.sub-item:hover { background: var(--card); }
.sub-item.checked { background: rgba(63,185,80,.08); }
.sub-item .left { display: flex; align-items: center; gap: .6rem; }
.sub-item .cb {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  transition: all .15s;
}
.sub-item.checked .cb {
  background: var(--accent);
  border-color: var(--accent);
}
.sub-item.checked .cb::after {
  content: '';
  display: block;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin: 1px auto 0;
}
.sub-item .name { font-size: .88rem; }
.sub-item .price { font-size: .82rem; color: var(--text-dim); white-space: nowrap; cursor: pointer; padding: 1px 3px; border-radius: 3px; transition: background .15s; }
.sub-item .price:hover { background: var(--accent-dim); color: var(--text); }
.sub-item .price .edit-icon { font-size: .65rem; opacity: 0; margin-left: 2px; }
.sub-item .price:hover .edit-icon { opacity: .6; }
.cmp-price-edit { border-bottom: 1px dashed transparent; transition: border-color .15s; }
.cmp-price-edit:hover { border-bottom-color: var(--accent); }
.cmp-price-edit .edit-icon { font-size: .65rem; opacity: .4; }
.sub-item .price.edited { color: var(--accent); font-weight: 600; }
.custom-tag { font-size: .65rem; background: var(--border); color: var(--text-dim); padding: 1px 5px; border-radius: 4px; }

/* ===== CUSTOM SUB FORM ===== */
.custom-add {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.custom-add input {
  flex: 1; min-width: 120px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .7rem;
  border-radius: 8px;
  font-size: .85rem;
  outline: none;
}
.custom-add input:focus { border-color: var(--accent); }
.custom-add button {
  background: var(--accent-dim);
  border: none;
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.custom-add button:hover { background: var(--accent); }

/* ===== TOTAL DISPLAY ===== */
.total-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}
.total-card .big-number { font-size: 2.5rem; font-weight: 800; }
.total-card .big-number.red { color: var(--red); }
.total-card .sub-stats { display: flex; justify-content: center; gap: 1.5rem; margin-top: .5rem; flex-wrap: wrap; }
.total-card .sub-stat { font-size: .82rem; color: var(--text-dim); }
.total-card .sub-stat strong { color: var(--text); }

.msg-box { margin-top: 1rem; font-size: .85rem; line-height: 1.6; }
.tip { background: rgba(63,185,80,.08); border: 1px solid var(--accent-dim); border-radius: 8px; padding: .7rem 1rem; }
.warn { background: rgba(248,81,73,.08); border: 1px solid var(--red); border-radius: 8px; padding: .7rem 1rem; }

/* ===== BREAKDOWN ===== */
.breakdown { margin-top: 1rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
}
.btn-primary { background: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-outline:hover { border-color: var(--text); color: var(--text); }

/* ===== FAQ ===== */
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .5rem;
  overflow: hidden;
}
.faq-q {
  padding: .8rem 1rem;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-q::after { content: '+'; font-size: 1.2rem; color: var(--text-dim); transition: transform .2s; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  padding: 0 1rem;
  font-size: .82rem;
  color: var(--text-dim);
}
.faq-item.open .faq-a { max-height: 300px; padding: 0 1rem .8rem; }

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-dim);
}

/* ===== AD SLOT ===== */
.ad-slot {
  max-width: 900px;
  margin: 1.5rem auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header h1 { font-size: 1.4rem; }
  .header p { font-size: .82rem; }
  .controls { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-row .b-name { width: 90px; font-size: .72rem; }
  .b-val { width: 50px; }
  .total-card .big-number { font-size: 2rem; }
  .total-card .sub-stats { gap: 1rem; }
}

/* ===== MODEL PRICE TABLE ===== */
.mp-filter.active { background:var(--blue); color:#fff; border-color:var(--blue); }

.model-table-wrap {
  overflow-x:auto;
  margin-top:.5rem;
  border-radius:10px;
  border:1px solid var(--border);
}

.model-table {
  width:100%;
  border-collapse:collapse;
  font-size:.82rem;
}

.model-table th {
  background:var(--bg);
  padding:.6rem .8rem;
  text-align:left;
  font-weight:600;
  color:var(--text-dim);
  border-bottom:1px solid var(--border);
  white-space:nowrap;
  cursor:pointer;
  user-select:none;
  position:sticky;
  top:0;
}

.model-table th:hover { color:var(--blue); }
.model-table th .sort-arrow { font-size:.7rem; opacity:.6; }

.model-table td {
  padding:.5rem .8rem;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}

.model-table tbody tr:hover { background:rgba(88,166,255,.06); }

.model-table .mp-name { font-weight:600; color:var(--text); }
.model-table .mp-provider { color:var(--text-dim); font-size:.75rem; }
.model-table .mp-price { font-variant-numeric:tabular-nums; color:var(--text); }
.model-table .mp-cost { font-weight:700; font-variant-numeric:tabular-nums; }
.model-table .mp-cheapest { color:#3fb950; }
.model-table .mp-cheap { color:#58a6ff; }
.model-table .mp-mid { color:var(--text); }
.model-table .mp-expensive { color:#f85149; }

.mp-provider-tag {
  display:inline-block;
  font-size:.68rem;
  padding:.1rem .4rem;
  border-radius:4px;
  background:rgba(88,166,255,.1);
  color:var(--blue);
}
