/* ============================================================
   Gig Enquiry Manager — Main Stylesheet
   Light / Dark mode via CSS custom properties
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #f5f6fa;
  --surface:     #ffffff;
  --surface2:    #f0f1f7;
  --border:      #e2e5ef;
  --text:        #1a1d2e;
  --text-muted:  #6b7280;
  --accent:      #4f6ef7;
  --accent-hov:  #3a56d4;
  --danger:      #e74c3c;
  --danger-hov:  #c0392b;
  --success:     #27ae60;
  --warning:     #f39c12;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --nav-h:       56px;
  --trans:       .18s ease;
}

[data-theme="dark"] {
  --bg:          #0b0d16;
  --surface:     #14172a;
  --surface2:    #1c2035;
  --border:      #5a6090;
  --text:        #ffffff;
  --text-muted:  #b8c4e0;
  --accent:      #8aaafe;
  --accent-hov:  #6f8ffd;
  --shadow:      0 1px 4px rgba(0,0,0,.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,.6);
}

/* ── Dark mode overrides ─────────────────────────────────────── */
[data-theme="dark"] .nav { background: #080a14; border-bottom: 2px solid #6070a8; }
[data-theme="dark"] .nav-brand { color: #ffffff; }
[data-theme="dark"] .nav-links a { color: #ffffff; font-weight: 500; }
[data-theme="dark"] .nav-links a:hover { background: #2a3060; color: #ffffff; }
[data-theme="dark"] .nav-links a.active { color: #8aaafe; font-weight: 700; }
[data-theme="dark"] .nav-user { color: #b8c4e0; }
[data-theme="dark"] .btn-ghost { color: #ffffff; border: 1px solid #6070a8; background: #1c2035; }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: #2a3060; color: #ffffff; border-color: #8aaafe; }
[data-theme="dark"] .btn-icon { color: #ffffff; }
[data-theme="dark"] .btn-secondary { background: #1c2035; color: #ffffff; border-color: #6070a8; }
[data-theme="dark"] .form-control { background: #12152a; border: 1px solid #6070a8; color: #ffffff; }
[data-theme="dark"] .form-control::placeholder { color: #8090b8; }
[data-theme="dark"] .form-control:focus { border-color: #8aaafe; background: #1a1e38; outline: none; }
[data-theme="dark"] .alert-success { background: #0e2a1a; border-color: #2a6a40; color: #80e8a8; }
[data-theme="dark"] .alert-error   { background: #2a0e0e; border-color: #8a2a2a; color: #ff9090; }
[data-theme="dark"] .alert-info    { background: #0e1e2e; border-color: #2a60a8; color: #80c8f8; }
[data-theme="dark"] .alert-warning { background: #2a1e08; border-color: #8a6018; color: #ffd060; }
[data-theme="dark"] .badge-blue  { background: #1a2a70; color: #a0c0ff; }
[data-theme="dark"] .badge-green { background: #0e2a1a; color: #80e8a8; }
[data-theme="dark"] .badge-red   { background: #2a0e0e; color: #ff9090; }
[data-theme="dark"] .form-label  { color: #ffffff; }
[data-theme="dark"] .form-hint   { color: #b8c4e0; }
[data-theme="dark"] .page-title  { color: #ffffff; }
[data-theme="dark"] .page-subtitle { color: #b8c4e0; }
[data-theme="dark"] .card { background: #14172a; border-color: #5a6090; }
[data-theme="dark"] .card-header { background: #1c2035; border-color: #5a6090; color: #ffffff; }
[data-theme="dark"] .table th { background: #1c2035; color: #b8c4e0; border-color: #5a6090; }
[data-theme="dark"] .table td { border-color: #5a6090; color: #ffffff; }
[data-theme="dark"] .table tr:hover td { background: #1c2035; }
[data-theme="dark"] .settings-section { background: #14172a; border-color: #5a6090; }
[data-theme="dark"] .enquiry-item { background: #14172a; border-color: #5a6090; }
[data-theme="dark"] .enquiry-item:hover { border-color: #8aaafe; }
[data-theme="dark"] .enquiry-date-block { background: #1c2035; }
[data-theme="dark"] .response-row { background: #1c2035; border-color: #5a6090; }
[data-theme="dark"] .log-entry { border-color: #5a6090; }
[data-theme="dark"] .log-entry-date { color: #8aaafe; }

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--trans), color var(--trans);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Nav ───────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; padding: 0 1.2rem; gap: 1rem;
}
.nav-brand {
  font-weight: 700; font-size: 1.1rem; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: .5rem;
}
.nav-brand svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-spacer { flex: 1; }
.nav-user { font-size: .85rem; color: var(--text-muted); }
.nav-links { display: flex; gap: .4rem; align-items: center; }
.nav-links a {
  padding: .35rem .8rem; border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text-muted);
  transition: background var(--trans);
}
.nav-links a:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--accent); font-weight: 600; }

/* Hamburger */
.nav-hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; padding: .4rem; cursor: pointer; flex-shrink: 0;
}
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dark mode toggle */
.btn-icon {
  background: none; border: none; padding: .4rem; border-radius: var(--radius-sm);
  color: var(--text-muted); transition: background var(--trans), color var(--trans);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius-sm);
  border: none; font-size: .88rem; font-weight: 500;
  transition: background var(--trans), box-shadow var(--trans), opacity var(--trans);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); text-decoration: none; }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); text-decoration: none; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hov); text-decoration: none; }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); text-decoration: none; }

.btn-ghost     { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); text-decoration: none; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-sm svg { width: 13px; height: 13px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: .35rem; font-size: .88rem; font-weight: 500; }
.form-control {
  width: 100%; padding: .55rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: .9rem; transition: border-color var(--trans), box-shadow var(--trans);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,110,247,.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
.form-hint  { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .25rem; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 1rem; border: 1px solid transparent;
}
.alert-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-error   { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.alert-info    { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.alert-warning { background: #fff3cd; border-color: #ffeeba; color: #856404; }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 2.2rem 2rem; width: 100%; max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 1.8rem; }
.auth-logo svg { margin-bottom: .5rem; }
.auth-logo h1 { font-size: 1.5rem; color: var(--text); }
.auth-logo p  { font-size: .88rem; color: var(--text-muted); margin-top: .3rem; }
.auth-footer  { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: var(--text-muted); }

/* ── Page layout ───────────────────────────────────────────── */
.page-wrap { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1.2rem; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .8rem;
}
.page-title    { font-size: 1.3rem; font-weight: 700; }
.page-subtitle { font-size: .88rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1.5rem; overflow: hidden;
}
.card-header {
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--border);
  background: var(--surface2); display: flex; align-items: center;
  justify-content: space-between; gap: .5rem;
}
.card-header h2, .card-header h3 {
  font-size: 1rem; font-weight: 600; margin: 0;
}
.card-body { padding: 1.2rem; }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.table th {
  text-align: left; padding: .5rem .75rem;
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
  background: var(--surface2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }

/* ── Settings ──────────────────────────────────────────────── */
.settings-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.settings-section-title { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.settings-section-desc  { font-size: .83rem; color: var(--text-muted); margin-bottom: 1.2rem; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: .15rem .5rem;
  border-radius: 999px; font-size: .75rem; font-weight: 500;
}
.badge-blue   { background: #e8ecff; color: var(--accent); }
.badge-green  { background: #d4edda; color: var(--success); }
.badge-red    { background: #fde8e8; color: var(--danger); }
.badge-grey   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-yellow { background: #fff3cd; color: #856404; }

/* ── Toast notifications ───────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  padding: .65rem 1rem; border-radius: var(--radius-sm);
  font-size: .88rem; color: #fff; box-shadow: var(--shadow-md);
  animation: toast-in .2s ease; max-width: 300px; pointer-events: all;
}
.toast.out { animation: toast-out .2s ease forwards; }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--accent); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .35; }
.empty-state h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--text); }
.empty-state p  { font-size: .88rem; }

/* ── Enquiry list (dashboard / closed) ────────────────────────── */
.enquiry-list { display: flex; flex-direction: column; gap: .7rem; }
.enquiry-item {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem 1.1rem;
  color: var(--text); transition: border-color var(--trans), box-shadow var(--trans);
}
.enquiry-item:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.enquiry-item-closed { opacity: .85; }
.enquiry-date-block {
  flex-shrink: 0; width: 52px; text-align: center;
  background: var(--surface2); border-radius: var(--radius-sm); padding: .4rem 0;
}
.enquiry-date-day { font-size: 1.15rem; font-weight: 700; line-height: 1; }
.enquiry-date-mon { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); margin-top: .15rem; }
.enquiry-info { flex: 1; min-width: 0; }
.enquiry-venue { font-weight: 600; font-size: .98rem; }
.enquiry-meta { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; }
.enquiry-responses { flex-shrink: 0; }
.app-arrow { flex-shrink: 0; color: var(--text-muted); font-size: 1.1rem; }

/* ── Band member response checklist ───────────────────────────── */
.response-list { display: flex; flex-direction: column; gap: .5rem; }
.response-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .9rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .9rem;
}
.response-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.response-name { font-weight: 600; flex: 1; }
.response-when { font-size: .78rem; }

/* ── Action log ────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: .9rem; }
.log-entry { display: flex; gap: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: none; padding-bottom: 0; }
.log-entry-date { flex-shrink: 0; width: 100px; font-size: .8rem; font-weight: 600; color: var(--accent); }
.log-entry-body { flex: 1; min-width: 0; }
.log-entry-note { font-size: .9rem; }
.log-entry-meta { font-size: .76rem; margin-top: .2rem; }

/* ── Misc ──────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.fw-600 { font-weight: 600; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .nav-user { display: none; }
  .nav-hamburger { display: flex; margin-left: auto; }
  .nav { height: auto; min-height: var(--nav-h); flex-wrap: wrap; padding: 0 .8rem; gap: .5rem; align-items: center; }
  .nav-spacer { display: none; }
  .nav-brand { padding: .8rem 0; }
  .nav > .btn-ghost { display: none; }
  .nav-links {
    display: none; flex-direction: column; width: 100%;
    padding: .4rem 0 .8rem; border-top: 1px solid var(--border); gap: 0;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links a { padding: .6rem .4rem; font-size: .9rem; }
  .enquiry-item { flex-wrap: wrap; }
  .page-wrap { padding: 1rem .8rem; }
}
@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1rem; }
}
