/* ==========================================================================
   Evie by Clear Code — Twilight Signal Design System
   Global CSS Custom Properties & Component Classes
   ========================================================================== */

/* ---------- Google Fonts (loaded in App.razor via <link>) ---------- */

:root {
    /* --- Backgrounds & Surfaces --- */
    --evie-bg: #171923;
    --evie-surface: #1F2231;
    --evie-surface-hover: #282C3D;
    --evie-card: #1C1F2E;
    --evie-border: #323748;

    /* --- Brand & Action --- */
    --evie-primary: #6C8EEF;
    --evie-primary-hover: #5A7CE0;
    --evie-primary-muted: rgba(108, 142, 239, 0.12);
    --evie-coral: #EF6C5E;
    --evie-coral-muted: rgba(239, 108, 94, 0.15);
    --evie-verified: #5EC990;
    --evie-verified-muted: rgba(94, 201, 144, 0.15);
    --evie-warning: #E8A838;
    --evie-warning-muted: rgba(232, 168, 56, 0.15);

    /* --- Semantic Aliases --- */
    --evie-approved: #6C8EEF;
    --evie-error: #EF6C5E;

    /* --- Text --- */
    --evie-text: #E8EAF0;
    --evie-text-muted: #969BB0;
    --evie-text-dim: #6E7388;

    /* --- Additional --- */
    --evie-link-hover: #8BABFF;
    --evie-secondary-hover: #303446;
    --evie-page-gradient-stop: #1A1C28;

    /* --- Typography --- */
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'Geist Mono', monospace;
}

/* ---------- Global Reset & Base ---------- */

*, *::before, *::after {
    box-sizing: border-box;
    border-color: var(--evie-border);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.5;
    color: var(--evie-text);
    background-color: var(--evie-bg);
    font-feature-settings: "rlig" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 500;
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 1rem 0;
}

a {
    color: var(--evie-primary);
    text-decoration: none;
    transition: color 150ms;
}

a:hover {
    color: var(--evie-link-hover);
}

:focus-visible {
    outline: 2px solid var(--evie-primary);
    outline-offset: 2px;
}

/* ---------- Page Background ---------- */

.evie-page-bg {
    background: linear-gradient(135deg, #171923 0%, #1F2231 50%, #1A1C28 100%);
    min-height: 100vh;
}

/* ---------- Utility Classes ---------- */

.evie-surface {
    background-color: var(--evie-surface);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
}

.evie-section-title {
    font-weight: 600;
    color: var(--evie-text);
}

.evie-subtle {
    color: var(--evie-text-muted);
}

.font-mono {
    font-family: var(--font-mono);
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms, border-color 150ms;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--evie-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--evie-primary-hover);
}

.btn-secondary {
    background-color: var(--evie-surface-hover);
    color: var(--evie-text);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--evie-secondary-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--evie-text-muted);
    border: 1px solid var(--evie-border);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--evie-surface);
    color: var(--evie-text);
}

.btn-destructive {
    background-color: transparent;
    color: var(--evie-coral);
    border: 1px solid var(--evie-coral-muted);
}

.btn-destructive:hover:not(:disabled) {
    background-color: var(--evie-coral-muted);
}

/* ---------- Form Inputs ---------- */

.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--evie-border);
    border-radius: 0.5rem;
    background-color: var(--evie-card);
    color: var(--evie-text);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    transition: border-color 150ms, box-shadow 150ms;
}

.input::placeholder {
    color: var(--evie-text-dim);
}

.input:focus {
    outline: none;
    border-color: var(--evie-primary);
    box-shadow: 0 0 0 1px var(--evie-primary);
}

.input-compact {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.input-error {
    border-color: var(--evie-coral);
}

.input-error:focus {
    border-color: var(--evie-coral);
    box-shadow: 0 0 0 1px var(--evie-coral);
}

/* ---------- Labels ---------- */

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--evie-text-muted);
    margin-bottom: 0.25rem;
}

.label-compact {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--evie-text-dim);
    margin-bottom: 0.125rem;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: var(--evie-verified-muted);
    color: var(--evie-verified);
}

.badge-warning {
    background-color: var(--evie-warning-muted);
    color: var(--evie-warning);
}

.badge-error {
    background-color: var(--evie-coral-muted);
    color: var(--evie-coral);
}

.badge-info {
    background-color: var(--evie-primary-muted);
    color: var(--evie-primary);
}

.badge-dim {
    background-color: rgba(110, 115, 136, 0.15);
    color: var(--evie-text-dim);
}

/* ---------- Cards ---------- */

.card {
    background-color: var(--evie-card);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

/* ---------- Validation ---------- */

.validation-message {
    color: var(--evie-coral);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.valid.modified:not([type=checkbox]) {
    outline: none;
}

.invalid {
    outline: 1px solid var(--evie-coral);
}

/* ---------- Blazor Error UI ---------- */

#blazor-error-ui {
    background: var(--evie-surface);
    border-top: 2px solid var(--evie-coral);
    color: var(--evie-text);
    bottom: 0;
    box-sizing: border-box;
    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;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--evie-coral-muted);
    border: 1px solid var(--evie-coral);
    padding: 1rem;
    border-radius: 0.5rem;
    color: var(--evie-coral);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ---------- Animations ---------- */

@keyframes evie-slide-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-evie-slide-up {
    animation: evie-slide-up 350ms ease-out both;
}

@keyframes evie-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: evie-spin 1s linear infinite;
}

/* ---------- Page Titles ---------- */

.page-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--evie-text);
    margin-bottom: 1.5rem;
}
