/* =========================================================
   GoogleAdsDashboard - Netlab brand "The Neon Curator"
   ========================================================= */

:root {
  --primary:              #7e4391;
  --primary-container:    #eca8fe;
  --on-primary:           #ffffff;
  --secondary:            #4d6300;
  --secondary-container:  #caf155;
  --on-secondary-container:#3a4a00;
  --surface:              #f1f7ff;
  --surface-lowest:       #ffffff;
  --surface-low:          #e6f2ff;
  --surface-container:    #dce9f7;
  --surface-high:         #d0dfef;
  --surface-highest:      #cddff0;
  --on-surface:           #25303a;
  --outline-variant:      #a3aebb;
  --gradient-signature:   linear-gradient(135deg, #7e4391, #eca8fe);
  --shadow-ambient:       0 20px 40px rgba(37, 48, 58, 0.06);
  --shadow-soft:          0 2px 10px rgba(37, 48, 58, 0.04);
  --shadow-primary:       0 8px 30px rgba(126, 67, 145, 0.3);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted  { color: #5a6978; }
.small  { font-size: 0.8125rem; }
.error  { color: #b42318; min-height: 1.25rem; }
em      { color: var(--primary); font-style: normal; }

/* =========================== BRAND ==================== */
.brand {
  display: flex; align-items: center; gap: 0.65rem;
  font-weight: 700; font-size: 1.05rem;
}
.brand .dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient-signature);
  box-shadow: var(--shadow-primary);
}
.brand-text strong { font-weight: 800; }

/* =========================== TYPOGRAPHY =============== */
.display {
  font-size: 2.5rem; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.05;
  margin: 0.25rem 0 1.5rem;
}
@media (min-width: 900px){ .display { font-size: 3rem; } }
h1, h2 { font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem; }
h3 { font-weight: 700; margin: 0 0 1rem; }
.label {
  display: inline-block;
  font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--primary); margin: 0 0 0.25rem;
}
.big { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

/* =========================== BUTTONS & CHIPS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.75rem 1.5rem;
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  border: 0; border-radius: 3rem;
  cursor: pointer; text-decoration: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn-primary {
  background: var(--gradient-signature); color: var(--on-primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(126,67,145,.42); }
.btn-high {
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.btn-high:hover { transform: translateY(-2px); filter: brightness(1.04); }
.btn-ghost {
  background: transparent; color: var(--primary);
  border: 2px solid rgba(163,174,187,0.15);
}
.btn-ghost:hover { background: var(--surface-low); }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center;
  padding: 0.45rem 1.1rem; font: inherit; font-weight: 700; font-size: 0.88rem;
  border: 0; border-radius: 9999px;
  background: var(--surface-high); color: var(--on-surface);
  cursor: pointer;
}
.chip:hover { background: var(--surface-highest); }
.chip-sel {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

/* =========================== GLASS NAV ================ */
.glass-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 1rem 1.5rem;
  background: rgba(220, 233, 247, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.nav-spacer { flex: 1; }
#userBadge { color: var(--primary); font-weight: 700; }

/* =========================== VIEWS ==================== */
.view { min-height: 100vh; }

/* ----- LOGIN ----- */
.login-view {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1.5rem;
}
.login-card {
  width: 100%; max-width: 480px;
  background: var(--surface-lowest);
  border-radius: 3rem;
  padding: 3rem;
  box-shadow: var(--shadow-ambient);
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-form label {
  display: flex; flex-direction: column; font-weight: 700; gap: 0.35rem;
  font-size: 0.88rem;
}
input, select {
  font: inherit;
  background: var(--surface-highest);
  color: var(--on-surface);
  border: 2px solid transparent;
  border-radius: 1.5rem;
  padding: 0.85rem 1.15rem;
  outline: 0;
  transition: background 0.2s, border-color 0.2s;
}
input:focus, select:focus {
  background: var(--surface-lowest);
  border-color: var(--primary);
}

/* ----- APP ----- */
.app-view { padding-bottom: 4rem; }
.tab { padding: 2.5rem 2rem; max-width: 1400px; margin: 0 auto; }

.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; margin-bottom: 2rem;
}
.range-picker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  background: var(--surface-lowest);
  padding: 1rem 1.25rem; border-radius: 2rem;
  box-shadow: var(--shadow-soft);
}
.range-picker label { display: flex; flex-direction: column; font-size: 0.8rem; font-weight: 700; gap: 0.25rem; }
.preset-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ----- KPI CARDS ----- */
.totals-row {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--surface-lowest);
  border-radius: 2rem; padding: 1.5rem;
  box-shadow: var(--shadow-soft);
}
.kpi-card.accent {
  background: var(--gradient-signature); color: var(--on-primary);
  box-shadow: var(--shadow-primary);
}
.kpi-card.accent .label { color: rgba(255,255,255,0.8); }
.kpi-card .big { margin-top: 0.25rem; }

/* ----- CARDS & CHARTS ----- */
.card {
  background: var(--surface-lowest);
  border-radius: 3rem;
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s, transform 0.2s;
}
.grid-2 {
  display: grid; gap: 1.5rem; margin-bottom: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.chart-card { padding: 1.5rem 2rem; }

/* ----- TABLES ----- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
}
thead th {
  text-align: left; padding: 0.75rem 0.85rem;
  font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary);
  font-weight: 700;
}
tbody tr {
  background: var(--surface-lowest);
  transition: background 0.2s;
}
tbody tr:nth-child(even) { background: var(--surface-low); }
tbody tr:hover { background: var(--surface-high); }
tbody td {
  padding: 0.85rem; font-size: 0.92rem;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Top-3 rows */
tbody tr.rank-1 td:first-child::before { content: '🥇 '; }
tbody tr.rank-2 td:first-child::before { content: '🥈 '; }
tbody tr.rank-3 td:first-child::before { content: '🥉 '; }

/* ----- FORMS ----- */
.row-form {
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center;
  margin-top: 1rem;
}
.row-form input, .row-form select { min-width: 140px; }
.stacked-form {
  display: flex; flex-direction: column; gap: 1rem; max-width: 640px;
}
.stacked-form label {
  display: flex; flex-direction: column; gap: 0.35rem;
  font-size: 0.88rem; font-weight: 700;
}
.row-actions { display: flex; gap: 0.75rem; }
.hint-box {
  margin-top: 2rem; padding: 1.25rem 1.5rem;
  background: var(--surface-high); border-radius: 1.5rem;
}
.hint-box code {
  background: var(--surface-lowest); padding: 0.1rem 0.4rem;
  border-radius: 0.3rem; font-size: 0.9em;
}

/* ----- Import CSV ----- */
.dropzone {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(163, 174, 187, 0.45);
  border-radius: 2rem; padding: 2.5rem 1.5rem;
  background: var(--surface-low);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag {
  background: var(--surface-high);
  border-color: var(--primary);
  transform: scale(1.01);
}
.dropzone-inner { text-align: center; }
.dropzone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.dropzone-inner a { color: var(--primary); font-weight: 700; text-decoration: none; }
.dropzone-inner a:hover { text-decoration: underline; }

.preview-grid {
  display: grid; gap: 0.75rem; margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.preview-grid .kpi-card { padding: 1rem 1.25rem; border-radius: 1.25rem; }
.preview-grid .kpi-card .big { font-size: 1.5rem; }

.badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 9999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
}
.badge-daily { background: var(--secondary-container); color: var(--on-secondary-container); }
.badge-aggregate { background: var(--primary-container); color: var(--primary); }

h4 { font-weight: 700; margin: 0 0 0.5rem; }

.duplicate-warn {
  background: #fff4d6;
  border-radius: 1.5rem;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  color: #8a5a00;
  font-size: 0.95rem;
  line-height: 1.5;
}
.duplicate-warn b { color: #6b4500; }
.duplicate-warn code {
  background: rgba(0,0,0,0.08); padding: 0.1rem 0.4rem;
  border-radius: 0.3rem; font-size: 0.88em;
}
