/* EverDragon design system — reimplements the Bulma class names already used across
   every page/template, so pages don't need markup rewrites, only this stylesheet swap. */

:root {
    --font-heading: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --radius: 12px;
    --radius-lg: 16px;

    --fire: oklch(0.64 0.19 35);
    --fire-strong: oklch(0.56 0.20 25);
    --forest: oklch(0.58 0.14 155);
    --gold: oklch(0.78 0.14 85);
    --sky: oklch(0.68 0.12 220);
    --success: oklch(0.65 0.15 145);
    --danger: oklch(0.62 0.20 25);
    --warn: oklch(0.78 0.15 80);

    /* dark theme (default) */
    --bg: oklch(0.15 0.025 250);
    --bg-alt: oklch(0.12 0.02 250);
    --surface: oklch(0.20 0.03 250);
    --surface-2: oklch(0.25 0.035 250);
    --border: oklch(0.32 0.03 250);
    --text: oklch(0.94 0.008 250);
    --text-dim: oklch(0.68 0.02 250);
}

:root[data-theme="light"] {
    --bg: oklch(0.97 0.006 90);
    --bg-alt: oklch(0.99 0.004 90);
    --surface: oklch(1 0 0);
    --surface-2: oklch(0.94 0.008 90);
    --border: oklch(0.86 0.012 90);
    --text: oklch(0.20 0.02 250);
    --text-dim: oklch(0.45 0.02 250);
}

/* Admin area: same system, slightly desaturated/quieter surfaces */
.admin-shell {
    --bg: oklch(0.16 0.012 250);
    --bg-alt: oklch(0.13 0.01 250);
    --surface: oklch(0.20 0.012 250);
    --surface-2: oklch(0.24 0.014 250);
    --border: oklch(0.30 0.014 250);
    --text: oklch(0.93 0.004 250);
    --text-dim: oklch(0.63 0.01 250);
}
:root[data-theme="light"] .admin-shell {
    --bg: oklch(0.97 0.004 250);
    --bg-alt: oklch(0.99 0.002 250);
    --surface: oklch(1 0 0);
    --surface-2: oklch(0.94 0.004 250);
    --border: oklch(0.86 0.006 250);
    --text: oklch(0.20 0.01 250);
    --text-dim: oklch(0.46 0.01 250);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    transition: background .2s, color .2s;
}
a { color: inherit; text-decoration: none; }
::selection { background: oklch(0.64 0.19 35 / 0.35); }
img { max-width: 100%; }

/* ---------- Layout helpers (Bulma-compatible) ---------- */
.section { padding: 40px 24px 72px; max-width: 1080px; margin: 0 auto; }
.container { max-width: 1080px; margin: 0 auto; }
.columns { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 -8px; }
.columns .column { flex: 1 1 0; padding: 8px; min-width: 160px; }
.level { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.level-left, .level-right { display: flex; align-items: center; gap: 12px; }
.content ul, .content ol { padding-left: 22px; line-height: 1.7; }
.content h2 { font-family: var(--font-heading); font-size: 19px; font-weight: 700; margin: 28px 0 10px; }
.has-text-centered { text-align: center; }
.has-text-grey { color: var(--text-dim); }
.has-text-weight-bold { font-weight: 700; }
.has-background-info-light { background: oklch(0.30 0.09 220 / 0.18); }
.is-size-7 { font-size: 12.5px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mt-4 { margin-top: 20px; } .mt-5 { margin-top: 28px; }

/* ---------- Typography ---------- */
.title {
    font-family: var(--font-heading);
    font-weight: 700;
    margin: 0 0 8px;
    font-size: 28px;
}
.title.is-3 { font-size: 30px; }
.title.is-4 { font-size: 24px; }
.title.is-5 { font-size: 18px; }
.title.is-6 { font-size: 15px; }
.subtitle {
    font-family: var(--font-heading);
    color: var(--text-dim);
    font-weight: 600;
    margin: 0 0 20px;
    font-size: 18px;
}
.heading { font-size: 12.5px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }

/* ---------- Box / card ---------- */
.box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
}

/* ---------- Notifications ---------- */
.notification {
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.notification.is-success { background: oklch(0.30 0.08 145 / 0.18); border-color: oklch(0.55 0.14 145 / 0.5); color: var(--text); }
.notification.is-danger { background: oklch(0.30 0.10 25 / 0.18); border-color: oklch(0.55 0.16 25 / 0.5); }
.notification.is-warning { background: oklch(0.32 0.09 85 / 0.22); border-color: oklch(0.7 0.13 85 / 0.5); }
.notification.is-info { background: oklch(0.30 0.09 220 / 0.18); border-color: oklch(0.6 0.10 220 / 0.5); }

/* ---------- Tags / badges ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 3px 11px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}
.tag.is-success { background: oklch(0.30 0.08 145 / 0.35); border-color: transparent; color: oklch(0.85 0.06 145); }
.tag.is-danger { background: oklch(0.30 0.10 25 / 0.35); border-color: transparent; color: oklch(0.85 0.08 25); }
.tag.is-warning { background: oklch(0.32 0.09 85 / 0.4); border-color: transparent; color: oklch(0.85 0.08 85); }
.tag.is-info { background: oklch(0.30 0.09 220 / 0.4); border-color: transparent; color: oklch(0.85 0.06 220); }
.tag.is-light { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }

/* ---------- Buttons ---------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, opacity .12s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.is-primary { background: var(--fire); border-color: transparent; color: white; box-shadow: 0 6px 16px oklch(0.64 0.19 35 / 0.3); }
.button.is-success { background: var(--success); border-color: transparent; color: white; }
.button.is-danger { background: var(--danger); border-color: transparent; color: white; }
.button.is-warning { background: var(--warn); border-color: transparent; color: oklch(0.2 0.03 80); }
.button.is-info { background: var(--sky); border-color: transparent; color: oklch(0.18 0.03 220); }
.button.is-dark { background: var(--bg-alt); border-color: var(--border); color: var(--text); }
.button.is-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.button.is-small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.button.is-fullwidth { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field.is-grouped { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 0; }
.field.is-grouped .control { margin-bottom: 0; }
.label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.control { position: relative; }
.input, .textarea, select.select, .select select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    font-family: var(--font-body);
}
.textarea { resize: vertical; }
.select { display: inline-block; position: relative; width: 100%; }
.select select { appearance: none; cursor: pointer; }
.select:not(.is-small)::after {
    content: '▾'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    pointer-events: none; color: var(--text-dim); font-size: 11px;
}
.select.is-small select { padding: 6px 28px 6px 10px; font-size: 13px; border-radius: 8px; }
.input:focus, .textarea:focus, select:focus { outline: none; border-color: var(--fire); box-shadow: 0 0 0 3px oklch(0.64 0.19 35 / 0.18); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ---------- Tables ---------- */
.table { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table thead tr { background: var(--surface-2); }
.table th {
    text-align: left; padding: 12px 18px; font-size: 12px; text-transform: uppercase;
    letter-spacing: .4px; color: var(--text-dim); font-weight: 700; border: none;
}
.table td { padding: 12px 18px; font-size: 14px; border-top: 1px solid var(--border); }
.table.is-striped tbody tr:nth-child(even) { background: color-mix(in oklab, var(--surface-2) 35%, transparent); }

/* ---------- Tabs ---------- */
.tabs ul { list-style: none; display: flex; gap: 6px; margin: 0 0 20px; padding: 0; border-bottom: 1px solid var(--border); }
.tabs li a { display: inline-block; padding: 10px 16px; font-weight: 700; font-size: 14px; color: var(--text-dim); border-bottom: 2px solid transparent; }
.tabs li.is-active a { color: var(--sky); border-bottom-color: var(--sky); }

/* ---------- Public site header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.site-header-inner { max-width: 1280px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.site-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.site-brand span { font-family: var(--font-heading); font-weight: 700; font-size: 20px; }
.site-nav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.site-nav > a, .site-nav > .nav-group > button {
    padding: 9px 14px; border-radius: 8px; font-weight: 600; font-size: 14.5px;
    background: transparent; border: none; color: var(--text); cursor: pointer;
    font-family: var(--font-body); display: flex; align-items: center; gap: 5px;
}
.site-nav > a.is-active { background: var(--fire); color: white; }
.nav-group { position: relative; }
.nav-group button .chev { font-size: 10px; opacity: .6; }
.nav-dropdown {
    position: absolute; top: 100%; left: 0; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px; min-width: 200px; box-shadow: 0 12px 28px oklch(0 0 0 / 0.28);
    display: none; flex-direction: column;
}
.nav-group.is-open .nav-dropdown { display: flex; }
.nav-dropdown a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.nav-dropdown a:hover { background: var(--surface-2); }
@media (min-width: 769px) {
    .nav-group:hover .nav-dropdown { display: flex; }
}
.theme-toggle {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px; flex-shrink: 0;
}
.admin-link {
    padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
    border: 1px solid var(--border); background: var(--surface); flex-shrink: 0; white-space: nowrap;
}
.nav-burger { display: none; }
@media (max-width: 768px) {
    .site-nav { display: none; flex: 1 0 100%; order: 3; flex-direction: column; align-items: stretch; margin-top: 8px; }
    .site-nav.is-open { display: flex; }
    .nav-group.is-open .nav-dropdown { position: static; box-shadow: none; border: none; padding-left: 12px; }
    .nav-burger {
        display: block; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
        background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; order: 1;
    }
    .site-header-inner { flex-wrap: wrap; }
    .site-brand { order: 0; }
    .theme-toggle { order: 2; }
    .admin-link { order: 2; }
}

/* ---------- Public site footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); margin-top: 60px; }
.site-footer-grid { max-width: 1280px; margin: 0 auto; padding: 40px 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 32px; }
.site-footer-col-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); margin-bottom: 12px; }
.site-footer-links { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.site-footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.site-footer-brand img { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.site-footer-brand span { font-family: var(--font-heading); font-weight: 700; font-size: 16px; }
.site-footer-bottom { text-align: center; padding: 16px 24px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); }

/* ---------- Admin shell (sidebar layout) ---------- */
.admin-shell { display: flex; min-height: 100vh; background: var(--bg); color: var(--text); }
.admin-sidebar { width: 230px; flex-shrink: 0; background: var(--bg-alt); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar-brand { display: flex; align-items: center; gap: 9px; padding: 6px 10px 20px; }
.admin-sidebar-brand img { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; }
.admin-sidebar-brand span { font-family: var(--font-heading); font-weight: 700; font-size: 15.5px; }
.admin-sidebar a, .admin-sidebar button.link-like {
    padding: 10px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--text);
    background: transparent; border: none; text-align: left; cursor: pointer; font-family: var(--font-body);
}
.admin-sidebar a.is-active { background: var(--surface); }
.admin-sidebar a:hover { background: var(--surface); }
.admin-sidebar .spacer { flex: 1; }
.admin-sidebar .danger-link { color: var(--danger); }
.admin-main { flex: 1; padding: 40px 40px 60px; max-width: 1080px; }
@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
    .admin-main { padding: 24px 20px 48px; }
}

/* ---------- Achievement badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.badge-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 10px; text-align: center; opacity: .4; }
.badge-item.is-achieved { opacity: 1; border-color: var(--gold); }
.badge-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.badge-item.is-achieved .badge-icon { background: var(--gold); }
.badge-label { font-size: 12.5px; font-weight: 700; line-height: 1.3; }

/* ---------- Stat tiles ---------- */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat-tile .stat-value { font-family: var(--font-heading); font-size: 24px; font-weight: 700; }

hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-size: 13px; }

/* ---------- LiveMap ---------- */
#livemap-container { border-radius: 20px; overflow: hidden; }
.leaflet-container { background: #0a1a1c !important; font-family: var(--font-body) !important; }
