/* Display board themes — loaded last so these rules win */

/* ========== CSS variables (light default) ========== */
:root,
html[data-theme="light"],
.app-shell.theme-light {
    --bg-primary: #f5f6f8;
    --bg-secondary: #ffffff;
    --main-bg: #f5f6f8;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --gold-primary: #d4af37;

    --board-bg: #f5f6f8;
    --board-text: #1a1a1a;
    --board-heading: #1a1a1a;
    --board-muted: #6c757d;
    --board-gold: #d4af37;
    --board-panel: #ffffff;
    --board-border: #dee2e6;
    --board-ticket: #1a1a1a;
}

html[data-theme="dark"],
.app-shell.theme-dark {
    --bg-primary: #0b0d11;
    --bg-secondary: #12161e;
    --main-bg: #0b0d11;
    --card-bg: #12161e;
    --input-bg: #1a2030;
    --text-primary: #e8eaed;
    --text-secondary: #8b93a7;
    --border-color: #2a3140;
    --gold-primary: #d4af37;

    --board-bg: #0b0d11;
    --board-text: #e8eaed;
    --board-heading: #ffffff;
    --board-muted: #8b93a7;
    --board-gold: #d4af37;
    --board-panel: #12161e;
    --board-border: #2a3140;
    --board-ticket: #ffffff;
}

/* ========== Shell & page chrome ========== */
.app-shell {
    min-height: 100vh;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-shell.theme-light {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.app-shell.theme-dark {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

html[data-theme="light"] body,
html[data-theme="light"] #app {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

html[data-theme="dark"] body,
html[data-theme="dark"] #app {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Mud stays light palette; do not let it paint the page dark */
.mud-theme-provider,
.mud-layout {
    background-color: transparent !important;
}

/* ========== Board (scoped CSS uses --board-* vars above) ========== */
.app-shell.theme-light .display-board {
    background-color: var(--board-bg);
    color: var(--board-text);
}

.app-shell.theme-dark .display-board {
    background-color: var(--board-bg);
    color: var(--board-text);
}

/* ========== Shell toolbar (theme + config) ========== */
.shell-toolbar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.shell-toolbar__btn {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    min-width: 2.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shell-toolbar__btn:hover {
    border-color: var(--gold-primary);
}

.app-shell.theme-dark .shell-toolbar__btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ========== Auth loading ========== */
.auth-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    gap: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--gold-primary);
    border-radius: 50%;
    animation: theme-spinner-spin 1s linear infinite;
}

@keyframes theme-spinner-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
