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

:root {
  --green:        #1a6b2a;
  --green-light:  #2d8a40;
  --green-dark:   #145220;
  --red:          #c0392b;
  --red-dark:     #a93226;
  --gold:         #d4ac0d;
  --bg:           #f4f6f4;
  --surface:      #ffffff;
  --border:       #dde5dd;
  --text:         #1c2b1e;
  --text-muted:   #6b7e6e;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Auth Page ───────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a3d20 0%, #2d5a35 60%, #1a6b2a 100%);
}

.auth-banner {
  width: 100%;
  max-width: 480px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: center;
}
.auth-banner-warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.auth-banner-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.auth-container {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo svg { display: block; margin: 0 auto 12px; }
.auth-logo h1 { font-size: 22px; font-weight: 700; color: var(--green-dark); }
.auth-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color .2s;
}
.tab-btn.active {
  color: var(--green);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--green);
}

/* ── Dashboard Page ──────────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--green-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-email { font-size: 13px; opacity: .75; }

.dashboard-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--green-dark);
}
.history-card { overflow-x: auto; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.auth-back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.auth-back-link:hover { color: var(--green); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,107,42,.12);
}
input::placeholder { color: #b0bdb2; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0 10px;
}
.account-info-value {
  font-size: 15px;
  color: var(--text);
  padding: 6px 0;
  font-weight: 500;
}

.bot-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.bot-option-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
  cursor: pointer;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary  { background: var(--green);      color: white; }
.btn-primary:hover:not(:disabled)  { background: var(--green-light); }

.btn-danger   { background: var(--red);        color: white; }
.btn-danger:hover:not(:disabled)   { background: var(--red-dark); }

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

.btn-full { width: 100%; }
.btn-sm   { padding: 6px 14px; font-size: 13px; }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ── Errors & Banners ────────────────────────────────────────────────────── */
.error-msg {
  background: #fde8e8;
  color: var(--red);
  border: 1px solid #f5c0c0;
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 13px;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.banner-content { flex: 1; font-size: 14px; line-height: 1.5; }

.banner-warning {
  background: #fffbea;
  border: 1.5px solid #f0d060;
  color: #7a5c00;
}
.banner-success {
  background: #eafaf1;
  border: 1.5px solid #82d9a0;
  color: #155724;
}
.banner-info {
  background: #d1ecf1;
  border: 1.5px solid #bee5eb;
  color: #0c5460;
  justify-content: center;
}

/* ── Status Feed ─────────────────────────────────────────────────────────── */
.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.status-header h2 { margin-bottom: 0; }

.badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-idle    { background: #e8ede9; color: var(--text-muted); }
.badge-running { background: #eafaf1; color: #1a6b2a; }
.badge-found   { background: #d4edda; color: #155724; }
.badge-error   { background: #fde8e8; color: var(--red); }
.badge-stopped { background: #f0f0f0; color: #555; }

.status-feed {
  height: 280px;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f9fbf9;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.status-entry {
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1.45;
}
.status-idle     { color: var(--text-muted); }
.status-running  { color: #1a4d26; }
.status-countdown{ color: #7a5c00; font-weight: 600; }
.status-found    { color: #155724; font-weight: 700; background: #d4edda; padding: 6px 8px; }
.status-error    { color: var(--red); }
.status-stopped  { color: #555; }

/* ── History Table ───────────────────────────────────────────────────────── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
}
.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.history-table tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-muted); padding: 20px !important; }

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.pill-running { background: #eafaf1; color: #1a6b2a; }
.pill-found   { background: #d4edda; color: #155724; }
.pill-error   { background: #fde8e8; color: var(--red); }
.pill-aborted { background: #f0f0f0; color: #555; }
.pill-pending { background: #fff3cd; color: #856404; }
.pill-booked  { background: #d4edda; color: #155724; font-weight: 800; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop-in .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-icon { font-size: 52px; margin-bottom: 12px; }
.modal h2   { font-size: 22px; font-weight: 800; color: var(--green-dark); margin-bottom: 10px; }
.modal p    { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@keyframes pop-in {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Booking Countdown Bar ────────────────────────────────────────────── */
.countdown-bar {
  position: fixed;
  top: 60px; /* below topnav */
  left: 0;
  right: 0;
  z-index: 160;
  background: linear-gradient(135deg, #1a6b2a 0%, #2ecc71 100%);
  color: white;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  animation: slide-down .3s ease;
}
@keyframes slide-down {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}
.countdown-bar.countdown-urgent {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  animation: pulse-red 1s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: .85; }
}
.countdown-bar.countdown-expired {
  background: #888;
}
.countdown-bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  font-size: 15px;
}
.countdown-display {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  min-width: 56px;
  text-align: center;
}
.countdown-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: .85;
}

/* ── Action Panels (code entry / payment) ─────────────────────────────── */
.action-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: white;
  border-top: 3px solid var(--green);
  box-shadow: 0 -6px 30px rgba(0,0,0,.15);
  padding: 24px 20px 28px;
  animation: slide-up .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.action-panel-inner {
  max-width: 560px;
  margin: 0 auto;
}
.action-panel-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.action-panel h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.action-panel p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.action-timer-msg {
  font-size: 12px !important;
  color: #c0392b !important;
  margin-top: 8px !important;
  font-weight: 600;
}
.action-field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.action-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  letter-spacing: .08em;
  outline: none;
  transition: border-color .15s;
}
.action-input:focus { border-color: var(--green); }

.cc-form { display: flex; flex-direction: column; gap: 12px; }
.cc-form .action-input { flex: 1; font-size: 15px; }
.badge-waiting { background: #fff3cd; color: #856404; }
.stripe-loading { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px 0; }
.status-waiting { color: #856404; font-style: italic; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
