/*
 * themes.css — global design system: themes, typography, textures, component styles.
 *
 * Themes:
 *   Light (default):  <html data-theme="light">  or no attribute
 *   Dark:             <html data-theme="dark">
 *   VenueDB brand:    <html data-theme="venuedb"> (home page)
 *
 * JS tile URL helper (include on any map page):
 *   const dark = document.documentElement.dataset.theme === 'dark';
 *   const TILES = dark
 *       ? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
 *       : 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
 */

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

/* ── Light theme (default) ───────────────────────────────────────────────── */
:root,
[data-theme="light"] {
    --font-display: 'IBM Plex Sans', -apple-system, sans-serif;
    --font-body: 'IBM Plex Sans', -apple-system, sans-serif;

    --bg:           #f6f5f1;
    --surface:      #ffffff;
    --card:         #f0ede7;
    --border:       #ddd8ce;
    --accent:       #b07828;
    --text:         #1a1a1a;
    --muted:        #6b6358;
    --success:      #16a34a;
    --warn:         #d97706;
    --yellow:       #f59e0b;
    --orange:       #ea580c;
    --danger:       #dc2626;
    --purple:       #7c3aed;
    --dim:          #d1ccc3;

    --panel-bg:     #ffffff;
    --panel-border: #e8e4dc;
    --panel-shadow: 0 2px 14px rgba(0, 0, 0, .12);

    --s-confirmed:  #16a34a;
    --s-inprog:     #ca8a04;
    --s-candidates: #ea580c;
    --s-area:       #dc2626;
    --s-hotel:      #2563eb;
    --s-poi:        #7c3aed;
    --s-personal:   #6b7280;

    --grain-opacity: .35;
}

/* ── VenueDB brand theme (warm amber/sepia) ─────────────────────────────── */
[data-theme="venuedb"] {
    --bg:           #171210;
    --surface:      #231a13;
    --card:         #2e2118;
    --border:       #463323;
    --accent:       #d4953a;
    --text:         #f2e8d8;
    --muted:        #9a8268;
    --success:      #56d364;
    --warn:         #e3a338;
    --yellow:       #e8d44b;
    --orange:       #e8851a;
    --danger:       #f87171;
    --purple:       #a78bfa;
    --dim:          #463323;

    --panel-bg:     #231a13;
    --panel-border: #463323;
    --panel-shadow: 0 2px 20px rgba(0, 0, 0, .55);

    --s-confirmed:  #56d364;
    --s-inprog:     #e8d44b;
    --s-candidates: #e8851a;
    --s-area:       #f87171;
    --s-hotel:      #5b8def;
    --s-poi:        #a78bfa;
    --s-personal:   #7d8590;

    --grain-opacity: .5;
}

/* ── Dark theme ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg:           #0d1117;
    --surface:      #161b27;
    --card:         #1c2333;
    --border:       #2d3650;
    --accent:       #5b8def;
    --text:         #e6edf3;
    --muted:        #7d8590;
    --success:      #56d364;
    --warn:         #e3a338;
    --yellow:       #e8d44b;
    --orange:       #e8851a;
    --danger:       #f87171;
    --purple:       #a78bfa;
    --dim:          #3d4a5c;

    --panel-bg:     #161b27;
    --panel-border: #2d3650;
    --panel-shadow: 0 2px 20px rgba(0, 0, 0, .55);

    --s-confirmed:  #56d364;
    --s-inprog:     #e8d44b;
    --s-candidates: #e8851a;
    --s-area:       #f87171;
    --s-hotel:      #5b8def;
    --s-poi:        #a78bfa;
    --s-personal:   #7d8590;

    --grain-opacity: .3;
}


/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL STYLES — applied to every page that loads themes.css
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Film grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: var(--grain-opacity, .4);
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -.02em;
}
h1, .h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }
h4, .h4 { font-size: 1.1rem; }
h5, .h5 { font-size: 1rem; }

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    z-index: 2000;
    font-family: var(--font-body);
    font-size: .85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.navbar-brand {
    font-family: var(--font-display) !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    letter-spacing: -.01em;
}
.navbar .nav-link {
    font-weight: 500;
    font-size: .82rem;
    letter-spacing: .01em;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-color: var(--border);
    border-radius: 8px;
}
.card, .card-body { color: var(--text); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-control, .form-select {
    background-color: var(--bg);
    color: var(--text);
    border-color: var(--border);
    border-radius: 6px;
    font-size: .88rem;
}
.form-control:focus, .form-select:focus {
    background-color: var(--bg);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent), .15);
}
.form-control:disabled {
    background-color: var(--surface);
    color: var(--muted);
}
.form-label {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: .01em;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 500;
    font-size: .85rem;
    border-radius: 6px;
    transition: all .15s;
}
.btn-primary:hover {
    filter: brightness(1.1);
    background: var(--accent);
    border-color: var(--accent);
}
.btn-outline-light {
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 500;
}

/* ── Sign-in providers ───────────────────────────────────────────────────── */
.auth-provider-list {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.auth-provider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    width: 100%;
    padding: .5rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: not-allowed;
    opacity: 1;
}
a.auth-provider {
    cursor: pointer;
    text-decoration: none;
}
a.auth-provider:hover {
    border-color: var(--accent);
    color: var(--text);
}
.auth-provider-label {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}
.auth-provider-label i,
.auth-provider-icon {
    width: 1.05rem;
    height: 1.05rem;
    font-size: 1.05rem;
    flex: none;
}
.auth-provider-badge {
    flex: none;
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .15rem .45rem;
    white-space: nowrap;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table {
    color: var(--text);
    font-size: .85rem;
}
.table thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom-color: var(--border);
}
.table td { border-color: var(--border); }
.table-hover tbody tr:hover { background: var(--card); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    font-size: .85rem;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--muted) !important; }

/* Section labels (uppercase dividers) */
.section-label {
    font-family: var(--font-body);
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--muted);
}

/* ── Load animations ─────────────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .45s ease-out both; }
.delay-1 { animation-delay: .06s; }
.delay-2 { animation-delay: .12s; }
.delay-3 { animation-delay: .18s; }
.delay-4 { animation-delay: .24s; }
.delay-5 { animation-delay: .30s; }

/* ── Scrollbar (dark themes) ─────────────────────────────────────────────── */
[data-theme="dark"] ::-webkit-scrollbar,
[data-theme="venuedb"] ::-webkit-scrollbar {
    width: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track,
[data-theme="venuedb"] ::-webkit-scrollbar-track {
    background: var(--bg);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-theme="venuedb"] ::-webkit-scrollbar-thumb {
    background: var(--dim);
    border-radius: 4px;
}
