/* Hutton Helper - Base Web Layout */
:root {
    --bg-page: #0f0d13;
    --bg-surface: #1c1824;
    --bg-surface-elevated: #261f33;
    --border-color: #372e4a;
    --accent: #8e44ad;
    --accent-hover: #9b59b6;
    --accent-light: #cfb3ff;
    --text-primary: #dedede;
    --text-muted: #a79bb5;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --header-height: 70px;
}

body[data-theme="hutton-blue"] {
    --bg-page: #071522;
    --bg-surface: #102638;
    --bg-surface-elevated: #19394f;
    --border-color: #2b526d;
    --accent: #167ca6;
    --accent-hover: #2198c5;
    --accent-light: #8fdcff;
    --text-primary: #e2f2fa;
    --text-muted: #afc6d4;
}

body[data-theme="colour-accessible"] {
    --bg-page: #101820;
    --bg-surface: #1c2b36;
    --bg-surface-elevated: #293d4b;
    --border-color: #526879;
    --accent: #56b4e9;
    --accent-hover: #83c9f0;
    --accent-light: #f0e442;
    --text-primary: #f2f2f2;
    --text-muted: #d1dce3;
}

body[data-theme="high-contrast"] {
    --bg-page: #ffffff;
    --bg-surface: #f1f4f8;
    --bg-surface-elevated: #dce5ee;
    --border-color: #596b7d;
    --accent: #005a9c;
    --accent-hover: #004477;
    --accent-light: #003b70;
    --text-primary: #111820;
    --text-muted: #344454;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-stack);
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   TOP STICKY BANNER
   ========================================================================== */
.site-header {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.menu-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--accent-light);
    border-radius: 6px;
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    padding: 0;
}

.menu-toggle-btn:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--accent);
    color: #ffffff;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo {
    height: 45px;
    max-width: 100%;
    object-fit: contain;
}

.header-user-status {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.header-user-status strong {
    color: var(--accent-light);
}

.account-theme-menu {
    position: relative;
}

.account-theme-menu summary {
    cursor: pointer;
    list-style: none;
}

.account-theme-menu summary::-webkit-details-marker {
    display: none;
}

.account-theme-menu summary::after {
    content: " \25BE";
    color: var(--accent-light);
}

.account-theme-menu summary:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 4px;
    border-radius: 2px;
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 120;
    width: 250px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.account-menu-panel form {
    margin: 0;
}

.account-menu-panel form + form {
    margin-top: 14px;
}

.account-theme-menu label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.account-theme-menu select {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-page);
    color: var(--text-primary);
    font: inherit;
}

.account-theme-menu input[type="text"] {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-page);
    color: var(--text-primary);
    font: inherit;
}

.account-theme-menu select:focus-visible,
.account-theme-menu input[type="text"]:focus-visible,
.account-theme-menu button:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

.account-theme-menu .auth-btn {
    margin-top: 12px;
}

.account-menu-download {
    margin-top: 12px;
}

.account-menu-signout {
    margin-top: 10px;
}

/* ==========================================================================
   FLYOUT NAVIGATION DRAWER & BACKDROP
   ========================================================================== */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 100;
}

.menu-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.flyout-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.8);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
    display: flex;
    flex-direction: column;
}

.flyout-drawer.open {
    transform: translateX(0);
}

.flyout-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.flyout-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.5px;
}

.flyout-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.flyout-close-btn:hover {
    color: #ffffff;
}

.flyout-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 14px 20px 6px;
    font-weight: 700;
}

.flyout-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.flyout-nav a:hover {
    background: var(--bg-surface-elevated);
    color: #ffffff;
    border-left: 4px solid var(--accent);
    padding-left: 16px;
}

.flyout-footer-auth {
    padding: 18px 20px;
    border-top: 1px solid var(--border-color);
    background: #14111a;
}

.auth-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.auth-btn.login {
    background: var(--accent);
    color: #ffffff;
    border: none;
}

.auth-btn.login:hover {
    background: var(--accent-hover);
}

.auth-btn.logout {
    background: #2a1b24;
    border: 1px solid #5a2638;
    color: #ff859f;
}

.auth-btn.logout:hover {
    background: #3d1f2e;
}

.donor-star {
    display: inline-block;
    margin-left: 0.15em;
    font-size: 0.85em;
    line-height: 1;
    vertical-align: 0.05em;
}

.logging-settings {
    max-width: 760px;
    margin: 30px auto;
    padding: 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.logging-settings h1 {
    margin-top: 0;
    color: var(--accent-light);
}

.logging-settings-form {
    margin-top: 24px;
}

.logging-settings-form label {
    display: block;
    margin-bottom: 9px;
    color: var(--text-primary);
    font-weight: 600;
}

.logging-level-select {
    position: relative;
}

.logging-level-select::after {
    position: absolute;
    top: 50%;
    right: 18px;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--accent-light);
    border-bottom: 2px solid var(--accent-light);
    content: "";
    pointer-events: none;
    transform: translateY(-70%) rotate(45deg);
}

.logging-level-select select {
    width: 100%;
    min-height: 52px;
    padding: 12px 48px 12px 15px;
    appearance: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--bg-page), var(--bg-surface-elevated));
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.logging-level-select select:hover {
    border-color: var(--accent);
}

.logging-level-select select:focus-visible {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.logging-level-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.logging-save-button {
    max-width: 240px;
    margin-top: 16px;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.logging-save-button:hover {
    transform: translateY(-1px);
}

.logging-settings-hint {
    margin: 20px 0 0;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .logging-settings {
        margin: 12px auto;
        padding: 20px;
    }

    .logging-save-button {
        max-width: none;
    }
}

.password-input-wrap {
    position: relative;
}

.form-group .password-input-wrap > input {
    padding-right: 110px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    transform: translateY(-50%);
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--accent-light);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.2;
    cursor: pointer;
}

.password-toggle:hover {
    background: var(--bg-surface-elevated);
    color: #ffffff;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

.password-toggle svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

/* ========================================================================== 
   MAIN CONTENT & STICKY FOOTER
   ========================================================================== */
.site-main-content {
    flex-grow: 1;
    width: 100%;
    padding: 24px;
    box-sizing: border-box;
}

.site-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-inner p {
    margin: 0;
}

.footer-inner .footer-disclaimer,
.footer-inner .footer-support {
    margin-top: 6px;
}

.footer-inner a {
    color: var(--accent-light);
    text-decoration: none;
}

    /* News Ticker */
    .ticker-wrapper {
        position: relative;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        margin-bottom: 25px;
        display: flex;
        align-items: center;
        overflow: hidden;
    }
    .ticker-label {
        background: var(--accent);
        color: #ffffff;
        padding: 10px 18px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    .ticker-container {
        flex-grow: 1;
        overflow: hidden;
        white-space: nowrap;
    }
    .ticker-scroll {
        display: inline-block;
        padding-left: 100%;
        animation: ticker-scroll 55s linear infinite;
    }
    .ticker-scroll:hover { animation-play-state: paused; }
    .ticker-item {
        display: inline-block;
        padding: 0 1.5rem;
        font-size: 0.9rem;
        color: var(--accent-light);
    }
    .ticker-time {
        color: var(--text-muted);
        font-family: monospace;
        margin-right: 6px;
    }
    .ticker-item::after {
        content: ' • ';
        color: var(--accent);
        margin-left: 1.5rem;
    }
    .ticker-item:last-child::after { content: ''; }
    @keyframes ticker-scroll {
        0% { transform: translateX(0); }
        100% { transform: translateX(-100%); }
    }
