/* ============================================================
   WOOD FIRED GAMES — Nordic Brutalist Design System
   AccountManagementUI/wwwroot/css/app.css
   Nordic Brutalist theme: stark black, cream text, terracotta accents
   ============================================================ */

/* ============================================================
   0. Custom Fonts
   ============================================================ */
@font-face {
    font-family: 'Burford Rustic';
    src: url('../fonts/BurfordRusticLineMedium.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   1. Design Tokens (:root)
   ============================================================ */
:root {
    /* Background palette */
    --bg-page:      #111111;
    --bg-card:      #1A1A1A;
    --bg-elevated:  #2A2A2A;
    --bg-input:     #1A1A1A;

    /* Text palette */
    --text-primary:   #F5F2ED;
    --text-secondary: #888888;
    --text-tertiary:  #666666;
    --text-muted:     #999999;
    --text-inverted:  #111111;

    /* Accent palette */
    --accent-primary:    #b74129;
    --accent-primary-20: #b7412920;
    --accent-green:      #6B8E5E;
    --accent-purple:     #7C3AED;
    --accent-blue:       #2563EB;
    --success:           #6B8E5E;

    /* Backward-compat aliases for page CSS files */
    --accent-orange:    var(--accent-primary);
    --accent-pop-color: var(--accent-primary);

    /* Border palette */
    --border-subtle: #2A2A2A;
    --border-muted:  #3A3A3A;
    --border-heavy:  #F5F2ED;

    /* Radius scale — brutalist: all 0 except nav items */
    --radius-sm:   0;
    --radius-md:   0;
    --radius-lg:   0;
    --radius-xl:   0;
    --radius-pill: 0;
    --radius-nav:  8px;

    /* Spacing scale */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;

    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body:    'Inter', sans-serif;
    --font-mono:    'Space Mono', monospace;
    --font-brand:   'Burford Rustic', 'Space Grotesk', sans-serif;

    /* Font size scale */
    --text-xs:   11px;
    --text-sm:   13px;
    --text-base: 15px;
    --text-lg:   18px;
    --text-xl:   22px;
    --text-2xl:  28px;
    --text-3xl:  36px;

    /* Color scheme */
    color-scheme: dark;
}

/* ============================================================
   2. CSS Reset
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================
   3. Base Styles
   ============================================================ */
html, body {
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    color: var(--accent-primary);
    opacity: 0.8;
}

/* ============================================================
   4. App Shell Layout
   ============================================================ */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.main-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100vh;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

/* ============================================================
   5. Blazor Framework Styles (keep — not Bootstrap)
   ============================================================ */
#blazor-error-ui {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--border-muted);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
    background: var(--bg-elevated);
    border-left: 4px solid var(--accent-primary);
    color: var(--text-primary);
    display: block;
    padding: var(--space-md);
}

/* ============================================================
   6. Loading Progress (WASM boot spinner)
   ============================================================ */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-muted);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
    color: var(--text-secondary);
    font-family: var(--font-body);
}

/* ============================================================
   7. Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ============================================================
   8. Mobile Responsive (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .page-content {
        padding: var(--space-md);
        padding-bottom: 80px; /* Space for MobileTabBar */
    }
}
