/* ============================================================
   STYLE.CSS — All visual styles for PhoneSpec
   ============================================================ */

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

:root {
  --bg:        #0d0d0f;
  --surface:   #17171a;
  --border:    #2a2a2f;
  --text:      #e8e8ec;
  --muted:     #6b6b7a;
  --accent:    #7effa0;
  --accent2:   #7ec8ff;
  --accent3:   #ffb07e;
  --danger:    #ff7e7e;
  --radius:    12px;
  --mono:      'DM Mono', monospace;
  --sans:      'DM Sans', sans-serif;
}

/* ── Light mode overrides ────────────────────────────────── */
[data-theme="light"] {
  --bg:      #f5f5f7;
  --surface: #ffffff;
  --border:  #dcdce4;
  --text:    #1a1a1f;
  --muted:   #888898;
  --accent:  #16a34a;
  --accent2: #0284c7;
  --accent3: #d97706;
  --danger:  #dc2626;
}

[data-theme="light"] .suggestions,
[data-theme="light"] .toast          { background: #ffffff; }

[data-theme="light"] tbody tr        { border-bottom: 1px solid rgba(0,0,0,.06); }
[data-theme="light"] tbody tr:hover  { background: rgba(0,0,0,.03); }
[data-theme="light"] tbody tr.group-header { background: rgba(0,0,0,.03); }
[data-theme="light"] .sc-track       { background: rgba(0,0,0,.08); }
[data-theme="light"] .btn-download   { background: #e8e8ee; }
[data-theme="light"] .btn-x          { background: #1a1a1f; border-color: #888; }

html { scroll-behavior: smooth; }

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

/* ── Header ─────────────────────────────────────────────── */
header {
  padding: 40px 40px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 16px;
}

header h1 {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
}

header p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Main layout ─────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px;
}

/* ── Section labels ──────────────────────────────────────── */
.section-label {
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── Phone input section ─────────────────────────────────── */
.input-section { margin-bottom: 40px; }

.phone-inputs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.phone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  width: 220px;
  position: relative;
  transition: border-color 0.2s;
}

.phone-card:focus-within { border-color: var(--accent); }

.phone-card .card-label {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.phone-card input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  width: 100%;
}

.phone-card input::placeholder { color: var(--muted); }

.phone-card .remove-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.phone-card .remove-btn:hover {
  color: var(--danger);
  background: rgba(255, 126, 126, 0.1);
}

/* ── Suggestions dropdown ────────────────────────────────── */
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #1e1e23;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 100;
  display: none;
}
.suggestions.open { display: block; }
.suggestions li {
  list-style: none;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}
.suggestions li:hover { background: rgba(126, 255, 160, 0.08); }

/* ── Action row ──────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  border: none;
}
.btn:hover  { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #0d0d0f; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); opacity: 1; }

/* ── Status / error bar ──────────────────────────────────── */
.status-bar {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--mono);
  margin-bottom: 28px;
  display: none;
}
.status-bar.loading {
  display: block;
  background: rgba(126, 200, 255, 0.08);
  border: 1px solid rgba(126, 200, 255, 0.2);
  color: var(--accent2);
}
.status-bar.error {
  display: block;
  background: rgba(255, 126, 126, 0.08);
  border: 1px solid rgba(255, 126, 126, 0.2);
  color: var(--danger);
}

/* ── Spinner ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* ── Results section ─────────────────────────────────────── */
.results { display: none; }
.results.visible { display: block; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  text-align: left;
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th.phone-header {
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--sans);
  font-weight: 600;
}

/* Color-code each phone column header */
thead th.phone-header:nth-child(2) { color: var(--accent);  }
thead th.phone-header:nth-child(3) { color: var(--accent2); }
thead th.phone-header:nth-child(4) { color: var(--accent3); }

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.12s;
}
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

tbody td {
  padding: 13px 18px;
  vertical-align: top;
  line-height: 1.5;
}

/* Spec label column */
tbody td:first-child {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  width: 160px;
}

tbody td.cell-value { color: var(--text); }

/* Best value highlight — color matches the column header */
tbody td.best { font-weight: 600; }
tbody td.best:nth-child(2) { color: var(--accent);  }
tbody td.best:nth-child(3) { color: var(--accent2); }
tbody td.best:nth-child(4) { color: var(--accent3); }

/* Empty / unknown value */
td.na { color: var(--muted); font-style: italic; }

/* ── AI Verdict card ─────────────────────────────────────── */
.winner-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 28px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.winner-row .badge {
  background: var(--accent);
  color: #0d0d0f;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  margin-top: 2px;
}

.winner-row p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  header, main { padding: 20px; }
  .phone-card  { width: 100%; }
}

/* -- Results header (label + share bar) -------------------- */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

/* -- Share bar --------------------------------------------- */
.share-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-label {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 2px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
}
.share-btn:hover  { opacity: 0.82; }
.share-btn:active { transform: scale(0.96); }

.btn-download { background: #2a2a2f; color: var(--text); border: 1px solid var(--border); }
.btn-wa       { background: #1fad4e; color: #fff; }
.btn-x        { background: #000;    color: #fff; border: 1px solid #333; }
.btn-tg       { background: #229ed9; color: #fff; }

/* ── Category group header rows ──────────────────────────── */
tbody tr.group-header { background: rgba(255,255,255,.025); pointer-events: none; }
tbody tr.group-header td,
tbody tr.group-header td:first-child {
  padding: 10px 18px 5px; font-family: var(--mono);
  font-size: .68rem; font-weight: 500; color: var(--muted);
  letter-spacing: .12em; text-transform: uppercase;
  border-bottom: 1px solid var(--border); width: auto;
}

/* ── "Data tidak tersedia" warning badge ─────────────────── */
thead th .not-found-badge {
  display: block; margin-top: 5px;
  font-family: var(--mono); font-size: .63rem; font-weight: 500;
  color: var(--danger); background: rgba(255,126,126,.10);
  border: 1px solid rgba(255,126,126,.25);
  border-radius: 4px; padding: 2px 7px; letter-spacing: .04em;
  white-space: nowrap;
}
tbody td.col-unavailable { opacity: .38; }

/* ── AI Score Card ───────────────────────────────────────── */
#scoreCard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin-top: 16px;
}
.sc-header { margin-bottom: 18px; }
.sc-grid   { display: flex; flex-direction: column; gap: 22px; }
.sc-row    { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; }
.sc-cat    {
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; padding-top: 2px;
}
.sc-bars   { display: flex; flex-direction: column; gap: 9px; }
.sc-bar-row { display: grid; grid-template-columns: 160px 1fr 40px; align-items: center; gap: 10px; }
.sc-pname  { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-track  { height: 6px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.sc-fill   { height: 100%; border-radius: 999px; opacity: .85; transition: width .55s cubic-bezier(.4,0,.2,1); }
.sc-score  { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-align: right; }
@media (max-width: 600px) {
  .sc-row     { grid-template-columns: 1fr; }
  .sc-bar-row { grid-template-columns: 1fr 1fr 36px; }
}

/* -- Screenshot footer (only visible in the image) --------- */
.screenshot-footer {
  display: none;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  letter-spacing: 0.06em;
}

/* -- Toast notification ------------------------------------ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e23;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--mono);
  padding: 10px 20px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  z-index: 999;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  animation: fadeUp 0.2s ease forwards;
}
.toast.hide {
  animation: fadeOut 0.3s ease forwards;
}

/* ── Theme toggle button ─────────────────────────────────── */
.theme-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  transition: color .15s, border-color .15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--text); }

.icon-sun { display: none; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }