/* =========================================================================
   Around29 Forms — Stylesheet
   Dark theme · IBM Plex Mono labels · Outfit body · orb bg · grid overlay
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* surfaces */
  --bg:            #08080d;
  --bg-elev:       #0e0e15;
  --card:          rgba(255, 255, 255, 0.025);
  --card-hover:    rgba(255, 255, 255, 0.045);
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* text */
  --text:          #ebebef;
  --text-dim:      #9a9aa8;
  --text-mute:     #62626f;

  /* accent — electric lime, distinctive without being garish */
  --accent:        #b8e62e;
  --accent-soft:   rgba(184, 230, 46, 0.12);
  --accent-glow:   rgba(184, 230, 46, 0.35);

  /* status */
  --success:       #4ade80;
  --warning:       #fbbf24;
  --danger:        #f87171;
  --info:          #60a5fa;

  /* type */
  --font-body:     'Outfit', system-ui, sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, monospace;

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;

  /* theme-switchable surfaces */
  --bg-field:      #0e0e15;
  --bg-tooltip:    #1a1a26;
  --sidebar-bg:    rgba(8,8,13,0.6);
  --table-stripe:  rgba(255,255,255,0.015);
  --shadow-card:   0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -20px rgba(0,0,0,0.6);
}

/* ---- Light theme overrides --------------------------------------------- */
[data-theme="light"] {
  color-scheme: light;
  --bg:            #f0f0f6;
  --bg-elev:       #ffffff;
  --bg-field:      #f4f4f8;
  --bg-tooltip:    #ffffff;
  --card:          rgba(0,0,0,0.025);
  --card-hover:    rgba(0,0,0,0.045);
  --border:        rgba(0,0,0,0.09);
  --border-strong: rgba(0,0,0,0.16);
  --text:          #18181f;
  --text-dim:      #4a4a5a;
  --text-mute:     #8a8a9a;
  --accent:        #6fa800;
  --accent-soft:   rgba(111,168,0,0.12);
  --accent-glow:   rgba(111,168,0,0.25);
  --sidebar-bg:    rgba(244,244,250,0.95);
  --table-stripe:  rgba(0,0,0,0.018);
  --shadow-card:   0 1px 0 rgba(255,255,255,0.9) inset, 0 4px 24px rgba(0,0,0,0.07);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(111,168,0,0.06), transparent 55%),
    radial-gradient(ellipse 50% 60% at 85% 80%, rgba(99,102,241,0.05), transparent 55%),
    radial-gradient(ellipse 40% 40% at 60% 40%, rgba(244,114,182,0.03), transparent 55%);
}
[data-theme="light"] body::after {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}
[data-theme="light"] option { background: #f4f4f8; color: #18181f; }
[data-theme="light"] .auth-card { box-shadow: var(--shadow-card); }
[data-theme="light"] .table th { background: var(--table-stripe); }
[data-theme="light"] .table tr:hover td { background: var(--table-stripe); }
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .badge-paused { background: rgba(0,0,0,0.04); }

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

/* Force rendering on all native form controls (overridden per theme) */
:root { color-scheme: dark; }
select, input, textarea, button { color-scheme: dark; }
[data-theme="light"], [data-theme="light"] select,
[data-theme="light"] input, [data-theme="light"] textarea,
[data-theme="light"] button { color-scheme: light; }
option { background: #0e0e15; color: #ebebef; }
option:hover, option:checked { background: #1a1a24; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ------- Atmosphere: orbs + grid overlay -------------------------------- */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(184,230,46,0.08), transparent 55%),
    radial-gradient(ellipse 50% 60% at 85% 80%, rgba(99,102,241,0.07), transparent 55%),
    radial-gradient(ellipse 40% 40% at 60% 40%, rgba(244,114,182,0.04), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 40%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 40%, transparent 95%);
  pointer-events: none;
  z-index: 0;
}

/* All real content above the atmosphere */
.app, .auth-shell { position: relative; z-index: 1; }

/* ------- Typography helpers -------------------------------------------- */
.label, .mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--font-body); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* ============================================================
   AUTH (login)
   ============================================================ */
.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.auth-brand .dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-glow);
}
.auth-brand .name {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.auth-card h1 {
  font-size: 22px;
  margin-top: 18px;
  margin-bottom: 4px;
}
.auth-card p.sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 26px;
}

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-field);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2362626f' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(184,230,46,0.04);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: var(--text-mute); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { background: var(--card-hover); border-color: var(--border-strong); }
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: #c8f04a;
  box-shadow: 0 0 24px var(--accent-soft);
  color: #0a0a0a;
}
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { color: var(--danger); border-color: rgba(248,113,113,0.3); }
.btn-danger:hover { background: rgba(248,113,113,0.08); border-color: var(--danger); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--card-hover); border-color: var(--border-strong); color: var(--text); }

.icon-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn-danger svg { width: 15px; height: 15px; }
.icon-btn-danger:hover { background: rgba(248,113,113,0.08); border-color: var(--danger); }

/* Sync info badge — centred on the top-right corner of the button */
.sync-info-badge {
  position: absolute;
  top: -30px;
  right: -13px;
  transform: translate(50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: var(--text-dim);
  z-index: 10;
}
.sync-info-badge svg { width: 9px; height: 9px; }
.sync-info-badge:hover { border-color: var(--accent); color: var(--accent); }

/* Custom tooltip — appears above, anchored right */
.tip-tr { position: relative; }
.tip-tr::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--bg-tooltip);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 99;
}
.tip-tr:hover::after { opacity: 1; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.07); color: #fca5a5; }
.alert-success { border-color: rgba(74,222,128,0.3);  background: rgba(74,222,128,0.07); color: #86efac; }
.alert-info    { border-color: rgba(96,165,250,0.3);  background: rgba(96,165,250,0.07); color: #93c5fd; }

/* ============================================================
   APP SHELL — sidebar + main
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  backdrop-filter: blur(8px);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar .brand .dot {
  width: 10px; height: 10px; background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}
.sidebar .brand .name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sidebar .nav-label {
  padding: 14px 12px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.sidebar a.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.sidebar a.nav:hover { background: var(--card); color: var(--text); }
.sidebar a.nav.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar .nav svg { width: 16px; height: 16px; opacity: 0.85; }
.sidebar .footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 14px 12px 4px;
  font-size: 13px;
  color: var(--text-dim);
}
.sidebar .footer .who { color: var(--text); margin-bottom: 2px; }
.sidebar .footer .role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  text-transform: uppercase;
}
.sidebar .footer a.logout {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.sidebar .footer a.logout:hover { color: var(--danger); }

/* main area */
.main {
  padding: 28px 36px 60px;
  max-width: 100%;
  overflow-x: hidden;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.page-head .crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 4px;
}

/* ============================================================
   STAT TILES
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at 100% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.stat .label { margin-bottom: 8px; }
.stat .value {
  font-size: 28px; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat .delta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ============================================================
   CARDS / TABLES
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 11px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 500;
  background: var(--table-stripe);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--table-stripe); }
.table td.mono { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty .icon { font-size: 32px; margin-bottom: 10px; opacity: 0.5; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active   { color: var(--success); background: rgba(74,222,128,0.08);  border-color: rgba(74,222,128,0.2); }
.badge-paused   { color: var(--text-mute); background: rgba(255,255,255,0.04); border-color: var(--border); }
.badge-new      { color: var(--accent); background: var(--accent-soft); border-color: rgba(184,230,46,0.2); }
.badge-viewed   { color: var(--info); background: rgba(96,165,250,0.08); border-color: rgba(96,165,250,0.2); }
.badge-spam     { color: var(--danger); background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.2); }
.badge-admin    { color: var(--warning); background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.2); }
.badge-website  { color: #a78bfa; background: rgba(167,139,250,0.08); border-color: rgba(167,139,250,0.2); }
.badge-landing  { color: #34d399; background: rgba(52,211,153,0.08);  border-color: rgba(52,211,153,0.2); }

/* ============================================================
   FLEX UTIL
   ============================================================ */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; } .mt-24 { margin-top: 24px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px;
  }
  .sidebar .brand { padding: 4px 8px; border-bottom: none; margin-bottom: 0; margin-right: auto; }
  .sidebar .nav-label { display: none; }
  .sidebar a.nav { padding: 7px 10px; font-size: 13px; }
  .sidebar .footer { width: 100%; border-top: 1px solid var(--border); margin-top: 10px; }
  .main { padding: 18px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .table th, .table td { padding: 9px 12px; }
}

/* ---- Dialog / Modal ---------------------------------------------------- */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
