/*
 * Stagecraft — Global Stylesheet
 *
 * Dark theme foundation: CSS custom properties, a minimal reset,
 * and base element styling. Component-scoped .razor.css files build
 * on top of these variables. There is no light mode and none is planned.
 */

/* ----------  Theme Variables  ---------- */

:root {
    /* Surface palette — layered dark greys with a hint of warmth */
    --bg-base:        #121212;  /* page background            */
    --bg-surface:     #1a1a1a;  /* panels, sidebar, cards      */
    --bg-surface-2:   #232323;  /* elevated elements, inputs   */
    --bg-surface-3:   #2e2e2e;  /* hover states, active items  */

    /* Text */
    --text-primary:   #e0e0e0;  /* body text                  */
    --text-secondary: #a0a0a0;  /* labels, meta, hints        */
    --text-muted:     #6e6e6e;  /* disabled, low-emphasis      */

    /* Accent — used for links, focus rings, active nav */
    --accent:         #6b9ed2;
    --accent-hover:   #8bb5e0;
    --accent-pressed:  #4b7ea8;

    /* Semantic */
    --danger:         #d36b6b;
    --warning:        #d2a86b;
    --success:        #6bd28b;

    /* Borders & dividers */
    --border:         #333333;
    --border-subtle:  #2a2a2a;

    /* Spacing scale (8px base) */
    --space-1:  0.25rem;   /*  4px */
    --space-2:  0.5rem;    /*  8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.5rem;    /* 24px */
    --space-6:  2rem;      /* 32px */
    --space-7:  3rem;      /* 48px */

    /* Radii */
    --radius-sm:  4px;
    --radius:      8px;
    --radius-lg:   12px;

    /* Typography */
    --font-sans:  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono:  "SF Mono", "Cascadia Code", "Consolas", monospace;

    /* Shadows */
    --shadow:        0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg:     0 8px 24px rgba(0, 0, 0, 0.4);

    /* Layout */
    --sidebar-width: 260px;
}

/* ----------  Reset  ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

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

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ----------  Base Elements  ---------- */

button {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

button:hover {
    background-color: var(--bg-surface-3);
    border-color: var(--bg-surface-3);
}

button:active {
    background-color: var(--accent-pressed);
    border-color: var(--accent-pressed);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input,
textarea {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--bg-surface-2);
    padding: 0.15em 0.35em;
    border-radius: var(--radius-sm);
}

/* ----------  Scrollbar  ---------- */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-3);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ----------  Blazor Error UI  ---------- */

#blazor-error-ui {
    color-scheme: dark only;
    background: var(--bg-surface);
    color: var(--text-primary);
    border-top: 1px solid var(--danger);
    bottom: 0;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: var(--space-3) var(--space-5);
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--space-4);
    top: var(--space-2);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

#blazor-error-ui .reload {
    color: var(--accent);
    margin-left: var(--space-2);
}
