/* ═══════════════════════════════════════════════════
   CB SNR Panel v2 — style.css
   ═══════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: 'Segoe UI', Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 220px;
  --header-h: 60px;
  --transition: 0.25s ease;
}

/* ── DARK THEME (default) ─────────────────────────── */
[data-theme="dark"] {
  --bg:          #0c1120;
  --bg2:         #111827;
  --surface:     #1a2236;
  --surface2:    #1e293b;
  --border:      rgba(51,65,85,0.6);
  --border2:     #1e293b;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --sidebar-bg:  #0d1525;
  --header-bg:   rgba(13,21,37,0.92);
  --input-bg:    rgba(10,16,30,0.6);
  --hover-bg:    rgba(124,58,237,0.06);
  --nav-active:  rgba(124,58,237,0.2);
  --nav-active-border: #7c3aed;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --primary:     #7c3aed;
  --primary2:    #4f46e5;
  --cyan:        #06b6d4;
  --green:       #10b981;
  --yellow:      #f59e0b;
  --red:         #ef4444;
  --mono-bg:     rgba(0,0,0,0.35);
}

/* ── LIGHT THEME ──────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f1f5f9;
  --bg2:         #e9eef5;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      rgba(203,213,225,0.8);
  --border2:     #e2e8f0;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-dim:    #475569;
  --sidebar-bg:  #1e1b4b;
  --header-bg:   rgba(255,255,255,0.92);
  --input-bg:    #f8fafc;
  --hover-bg:    rgba(124,58,237,0.04);
  --nav-active:  rgba(255,255,255,0.15);
  --nav-active-border: #a5b4fc;
  --shadow:      0 4px 20px rgba(0,0,0,0.08);
  --primary:     #7c3aed;
  --primary2:    #4f46e5;
  --cyan:        #0891b2;
  --green:       #059669;
  --yellow:      #d97706;
  --red:         #dc2626;
  --mono-bg:     #f1f5f9;
}

/* ── Body & Shell ─────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-icon {
  font-size: 20px;
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.25);
  padding: 8px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--nav-active);
  color: #fff;
  border-left-color: var(--nav-active-border);
}

.nav-icon { font-size: 16px; }
.nav-label { font-size: 14px; }

.sidebar-footer {
  padding: 16px 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  border-top: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}

/* ── MAIN WRAP ────────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.main-wrap.full {
  margin-left: 0;
}

/* ── TOP HEADER ───────────────────────────────────── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-dim);
  padding: 6px 8px;
  border-radius: 8px;
  transition: background var(--transition);
  line-height: 1;
}
.sidebar-toggle:hover { background: var(--hover-bg); color: var(--text); }

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  color: var(--text);
}
.theme-btn:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
  transform: rotate(20deg);
}

/* ── PAGE CONTENT ─────────────────────────────────── */
.page {
  display: none;
  padding: 28px 28px 0;
  flex: 1;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── INFO BANNER ──────────────────────────────────── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
  border: 1px solid transparent;
}
.info-green  { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.25); }
.info-yellow { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.25); }

.info-icon-wrap {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.green-bg  { background: rgba(16,185,129,0.2); }
.yellow-bg { background: rgba(245,158,11,0.2); }

.info-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.green-text  { color: #34d399; }
.yellow-text { color: #fbbf24; }

.info-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.8;
}
.info-desc strong { color: var(--text); }

/* ── INPUT GRID ───────────────────────────────────── */
.input-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.two-col   { grid-template-columns: repeat(2, 1fr); }
.three-col { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1000px) {
  .three-col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .main-wrap { margin-left: 0; }
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
}

/* ── CARD ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: background var(--transition), border-color var(--transition);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.cyan-bg   { background: rgba(6,182,212,0.18); }
.purple-bg { background: rgba(124,58,237,0.18); }
.card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.card-ext { margin-left: auto; font-size: 11px; color: var(--text-muted); }

/* ── UPLOAD ZONE ──────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 90px;
}
.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(124,58,237,0.04);
}
.upload-zone.uploaded {
  border-color: var(--green);
  background: rgba(16,185,129,0.04);
}
.uz-icon { font-size: 26px; }
.uz-text { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.uz-hint { font-size: 11px; color: var(--text-muted); }

/* ── STATS ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-box {
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }

/* ── PASTE GUIDE ──────────────────────────────────── */
.paste-guide {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 11px;
}
.guide-title { font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.tag-a { color: #a78bfa; font-weight: 600; }
.tag-b { color: #67e8f9; font-weight: 600; }
.mono-box {
  background: var(--mono-bg);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.7;
}
.dark-mono {
  background: #0f172a;
  border: 1px solid #1e293b;
  font-size: 13px;
}
.comment { color: var(--text-muted); font-style: italic; }

/* ── TEXTAREA ─────────────────────────────────────── */
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color var(--transition), background var(--transition);
}
textarea:focus { border-color: var(--primary); }
textarea::placeholder { color: var(--text-muted); }

/* ── BUTTONS ──────────────────────────────────────── */
.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

button { cursor: pointer; border: none; font-family: var(--font); transition: all var(--transition); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 0 22px rgba(124,58,237,0.35);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
}
.btn-secondary:hover { background: var(--hover-bg); color: var(--text); border-color: var(--primary); }

.btn-copy {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
}
.btn-copy:hover { background: var(--hover-bg); color: var(--text); }
.btn-copy.success {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.4);
  color: #34d399;
}

.btn-csv {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(6,182,212,0.1);
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.3);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
}
.btn-csv:hover { background: rgba(6,182,212,0.2); }

/* ── ERROR ────────────────────────────────────────── */
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  color: #f87171;
  font-size: 14px;
}

/* ── SUMMARY CARDS ────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.summary-card {
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.purple-card { border: 1px solid rgba(124,58,237,0.35); }
.cyan-card   { border: 1px solid rgba(6,182,212,0.35); }
.summary-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.summary-value { font-size: 22px; font-weight: 800; }

.gradient-text {
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cyan-text { color: var(--cyan); }

/* ── EXPORT ROW ───────────────────────────────────── */
.export-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── TABLE ────────────────────────────────────────── */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--bg2); border-bottom: 1px solid var(--border2); }
th {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
th.tc { text-align: center; }
th.tr { text-align: right; }

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
  color: var(--text-dim);
}
td.tc { text-align: center; color: var(--text-muted); font-size: 11px; }
td.tr { text-align: right; }
td.name { font-weight: 500; color: var(--text); }
td.cb-val { text-align: right; font-weight: 700; color: #a78bfa; }
td.neg { text-align: right; color: rgba(248,113,113,0.85); }

tbody tr:nth-child(even) { background: var(--bg2); }
tbody tr:hover { background: var(--hover-bg); }

/* ── POPUP ────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 200;
}

.popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px;
  max-width: 540px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  z-index: 201;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border2);
}
.popup-title { font-size: 16px; font-weight: 700; color: var(--text); }
.popup-close {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.popup-close:hover { color: var(--text); background: var(--hover-bg); }

.popup-section { margin-bottom: 20px; }
.popup-section-title { font-weight: 600; font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.popup-img { width: 100%; border-radius: 10px; border: 1px solid var(--border); margin-top: 6px; }
.popup-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ── FOOTER ───────────────────────────────────────── */
.app-footer {
  padding: 20px 28px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
  letter-spacing: 0.5px;
}

/* ── UTILITIES ────────────────────────────────────── */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.6); }
