/* Campsite Sniper — styles (mobile-first, matches dinner visual language) */

:root {
  color-scheme: dark;
  --bg: #12071f;
  --panel: rgba(38, 18, 58, 0.82);
  --text: #fbf6ff;
  --muted: rgba(251, 246, 255, 0.7);
  --gold: #f5d991;
  --line: rgba(245, 217, 145, 0.22);
  --purple: #a56cff;
  --purple-dark: #5d2b8f;
  --warn: #ffb4a2;
  --green: #9be7a0;
  --red: #ff7b7b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 12%, rgba(165, 108, 255, 0.32), transparent 28rem),
    radial-gradient(circle at 85% 22%, rgba(245, 217, 145, 0.16), transparent 24rem),
    linear-gradient(145deg, #0c0615, var(--bg) 48%, #250d3e);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(245, 217, 145, 0.65) 0 1px, transparent 1.5px);
  background-position: 0 0, 48px 72px;
  background-size: 120px 120px, 180px 180px;
  opacity: 0.28;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(18px, 4vw, 48px);
}

.panel {
  width: min(820px, 100%);
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), rgba(22, 9, 35, 0.9));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

/* ---- Heading ---- */

.heading {
  margin-bottom: 18px;
}

.heading p {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.heading .sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.85;
}

/* ---- Fields ---- */

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea {
  width: 100%;
  border: 1px solid rgba(245, 217, 145, 0.24);
  border-radius: 8px;
  background: rgba(12, 6, 21, 0.72);
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
  min-height: 48px;
  padding: 0 14px;
}

input[type="date"] {
  /* Ensure readable in dark mode */
  color-scheme: dark;
}

input:focus {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* ---- Buttons ---- */

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
}

.secondary {
  color: #231429;
  background: var(--gold);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.ghost:hover {
  color: var(--text);
  border-color: var(--gold);
}

.ghost.danger {
  color: var(--warn);
  border-color: rgba(255, 180, 162, 0.3);
}

.ghost.danger:hover {
  border-color: var(--warn);
}

/* ---- Auth ---- */

.auth-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
}

.tab-btn {
  flex: 1;
  min-height: 44px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.tab-btn.active {
  background: rgba(165, 108, 255, 0.25);
  color: var(--text);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-form button[type="submit"] {
  margin-top: 18px;
}

/* ---- Nav ---- */

.main-nav {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 18px 0;
}

.nav-btn {
  flex: 1;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-btn.active {
  background: rgba(165, 108, 255, 0.25);
  color: var(--text);
}

.nav-btn:not(.active):hover {
  color: var(--text);
  background: rgba(165, 108, 255, 0.1);
}

/* ---- Section titles ---- */

.section-title {
  margin: 0;
  color: var(--gold);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.9rem;
  line-height: 1;
}

.sub-section-title {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.view-header button {
  flex-shrink: 0;
}

/* ---- Views ---- */

.view {
  display: block;
}

.view[hidden] {
  display: none;
}

/* ---- Poller banner ---- */

.poller-banner {
  background: rgba(255, 123, 123, 0.15);
  border: 1px solid rgba(255, 123, 123, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  color: var(--warn);
  font-size: 0.88rem;
  font-weight: 700;
}

.poller-banner[hidden] {
  display: none;
}

/* ---- Watch cards ---- */

.watch-list {
  display: grid;
  gap: 12px;
}

.watch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 6, 21, 0.55);
  padding: 14px 16px;
}

.watch-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.watch-cg-name {
  flex: 1;
  font-size: 1rem;
}

.watch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.watch-actions button {
  min-height: auto;
  padding: 5px 14px;
  font-size: 0.82rem;
  border-radius: 999px;
}

/* ---- Status dots ---- */

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.dot-green { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dot-red   { background: var(--red);   box-shadow: 0 0 5px var(--red); }
.dot-gray  { background: rgba(251, 246, 255, 0.3); }

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-cart {
  background: rgba(245, 217, 145, 0.2);
  color: var(--gold);
  border: 1px solid rgba(245, 217, 145, 0.4);
}

.badge-error {
  background: rgba(255, 180, 162, 0.15);
  color: var(--warn);
  border: 1px solid rgba(255, 180, 162, 0.3);
  text-transform: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
}

.badge-channel {
  background: rgba(165, 108, 255, 0.2);
  color: var(--purple);
  border: 1px solid rgba(165, 108, 255, 0.35);
}

.badge-status-sent {
  background: rgba(155, 231, 160, 0.15);
  color: var(--green);
  border: 1px solid rgba(155, 231, 160, 0.3);
}

.badge-status-failed {
  background: rgba(255, 180, 162, 0.15);
  color: var(--warn);
  border: 1px solid rgba(255, 180, 162, 0.3);
}

.badge-status-suppressed {
  background: rgba(251, 246, 255, 0.08);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* ---- Typeahead ---- */

.typeahead-wrap {
  position: relative;
}

.typeahead-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(22, 9, 35, 0.97);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  max-height: 240px;
  overflow-y: auto;
}

.typeahead-list[hidden] {
  display: none;
}

.typeahead-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: auto;
  padding: 10px 14px;
  background: transparent;
  border-radius: 0;
  text-align: left;
  font-weight: 400;
  color: var(--text);
}

.typeahead-item:hover {
  background: rgba(165, 108, 255, 0.18);
}

.cg-name {
  font-weight: 600;
}

.cg-loc {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---- Toggle (checkbox switch) ---- */

.toggle-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.toggle-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  text-transform: none;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  min-height: 0;
  padding: 0;
  border: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background: rgba(251, 246, 255, 0.15);
  border: 1px solid var(--line);
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--purple-dark);
  border-color: var(--purple);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--text);
}

.toggle input:disabled + .toggle-slider {
  opacity: 0.45;
  cursor: not-allowed;
}

.toggle-hint {
  width: 100%;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Activity ---- */

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 6, 21, 0.55);
  padding: 12px 14px;
}

.activity-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 6px;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.82rem;
}

/* ---- Settings ---- */

.push-status {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 4px 0 12px;
}

.warn-box {
  background: rgba(255, 180, 162, 0.1);
  border: 1px solid rgba(255, 180, 162, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0 14px;
  font-size: 0.88rem;
  color: var(--warn);
  line-height: 1.5;
}

.creds-status {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.creds-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ---- Form feedback ---- */

.form-error {
  background: rgba(255, 180, 162, 0.12);
  border: 1px solid rgba(255, 180, 162, 0.3);
  border-radius: 6px;
  padding: 9px 12px;
  margin-top: 10px;
  color: var(--warn);
  font-size: 0.88rem;
}

.form-error[hidden] {
  display: none;
}

.form-success {
  background: rgba(155, 231, 160, 0.1);
  border: 1px solid rgba(155, 231, 160, 0.3);
  border-radius: 6px;
  padding: 9px 12px;
  margin-top: 10px;
  color: var(--green);
  font-size: 0.88rem;
}

.form-success[hidden] {
  display: none;
}

/* ---- Status bar (toast at bottom of panel) ---- */

.status-bar {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(165, 108, 255, 0.2);
  border: 1px solid rgba(165, 108, 255, 0.35);
  color: var(--text);
  font-size: 0.9rem;
}

.status-bar.error {
  background: rgba(255, 180, 162, 0.12);
  border-color: rgba(255, 180, 162, 0.3);
  color: var(--warn);
}

.status-bar[hidden] {
  display: none;
}

/* ---- Misc ---- */

.muted {
  color: var(--muted);
}

.empty-msg {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 12px 0;
}

.empty-msg[hidden] {
  display: none;
}

/* ---- Responsive ---- */

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .watch-actions button {
    flex: 1;
  }

  .creds-actions {
    flex-direction: column;
  }
}
