/* ============================================
   ALARM FLOOD — ONYX Insight Brand Theme
   Brand Guidelines: Summer 2025 Edition
   ============================================ */

:root {
    /* Core palette */
    --onyx-dark-blue: #0B053B;
    --onyx-bright-blue: #004DFF;
    --onyx-sky-blue: #7BE2FF;
    --onyx-sky-blue-40: #C8F2FE;

    /* Accent palette (use sparingly) */
    --onyx-red: #FF1B00;
    --onyx-red-dark: #cc1500;
    --onyx-green: #008F33;
    --onyx-green-dark: #006b26;
    --onyx-orange: #ED8A3B;
    --onyx-yellow: #FFCD00;

    /* Neutrals */
    --onyx-warm-grey: #E5E2E8;
    --onyx-dark-warm-grey: #CDC8D2;

    /* Legacy aliases (mapped to brand) */
    --onyx-navy-dark: #0B053B;
    --onyx-navy: #0f0a4d;
    --onyx-navy-light: #1a1266;
    --onyx-blue: #004DFF;
    --onyx-blue-dark: #0039c0;
    --onyx-amber: #ED8A3B;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #CDC8D2;
    --text-muted: #9e98a8;
    --text-faint: #7a7488;

    /* Surfaces */
    --card-bg: rgba(255,255,255,0.05);
    --card-border: rgba(255,255,255,0.08);
    --overlay-dark: rgba(0,0,0,0.25);
}

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

body {
    font-family: 'Aptos', 'Segoe UI', Tahoma, sans-serif;
    background: var(--onyx-dark-blue);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
}

/* Data pattern background texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url('/img/Data-Pattern---ONYX-White.png');
    background-repeat: repeat;
    background-size: 600px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

/* --- Shared Components --- */

.onyx-logo {
    display: block;
    margin-bottom: 12px;
}
.onyx-logo img {
    height: 44px;
    width: auto;
    opacity: 0.85;
}

.page-header {
    text-align: center;
    padding: 40px 20px 30px;
}
.page-header h1 {
    font-size: 3em;
    font-weight: 400;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}
.page-header .subtitle {
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 300;
}

.glass-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid var(--card-border);
}

.btn {
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: white;
    font-weight: 500;
    font-family: 'Aptos', 'Segoe UI', sans-serif;
    letter-spacing: 0.3px;
}
.btn:hover {
    transform: translateY(-3px);
}
.btn-blue {
    background: var(--onyx-bright-blue);
    box-shadow: 0 6px 20px rgba(0, 77, 255, 0.35);
}
.btn-blue:hover { box-shadow: 0 10px 30px rgba(0, 77, 255, 0.5); }

.btn-red {
    background: linear-gradient(135deg, var(--onyx-red) 0%, var(--onyx-red-dark) 100%);
    box-shadow: 0 6px 20px rgba(255, 27, 0, 0.35);
}
.btn-red:hover { box-shadow: 0 10px 30px rgba(255, 27, 0, 0.5); }

.btn-green {
    background: linear-gradient(135deg, var(--onyx-green) 0%, var(--onyx-green-dark) 100%);
    box-shadow: 0 6px 20px rgba(0, 143, 51, 0.35);
}
.btn-green:hover { box-shadow: 0 10px 30px rgba(0, 143, 51, 0.5); }

.btn-outline {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 12px 25px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 25px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    font-family: 'Aptos', 'Segoe UI', sans-serif;
    z-index: 100;
}
.back-btn:hover {
    background: white;
    color: var(--onyx-dark-blue);
}

/* --- Loading Overlay --- */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 5, 59, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.loading-overlay.hidden { display: none; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--onyx-bright-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Name Modal --- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 5, 59, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }

.modal {
    background: var(--onyx-navy);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal h2 {
    margin-bottom: 20px;
    font-weight: 400;
}
.modal input, .modal select {
    width: 100%;
    padding: 14px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 1.1em;
    font-family: 'Aptos', 'Segoe UI', sans-serif;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.3s;
}
.modal input:focus {
    border-color: var(--onyx-bright-blue);
}
.modal input::placeholder {
    color: var(--text-faint);
}

/* --- Alarm tag (monospace code label) --- */
.alarm-tag {
    font-family: 'Aptos', 'Consolas', 'Courier New', monospace;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0,77,255,0.12);
    color: var(--onyx-sky-blue);
    white-space: nowrap;
}

/* --- AI badge --- */
.ai-badge {
    display: inline-block;
    font-family: 'Aptos', 'Consolas', 'Courier New', monospace;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0,77,255,0.15);
    color: var(--onyx-bright-blue);
    border: 1px solid rgba(0,77,255,0.25);
    vertical-align: middle;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .page-header { padding: 25px 15px 20px; }
    .page-header h1 { font-size: 2em; }
    .page-header .subtitle { font-size: 1em; }

    .glass-card { padding: 20px 15px; border-radius: 12px; }

    .btn {
        padding: 12px 28px;
        font-size: 1em;
    }

    .back-btn {
        position: static;
        display: inline-block;
        margin: 15px;
    }
}

@media (max-width: 480px) {
    .page-header h1 { font-size: 1.6em; }

    .btn {
        padding: 10px 22px;
        font-size: 0.95em;
    }

    .modal { padding: 25px 20px; }
}
