/* =============================================================================
   MonsterMQ — brand tokens and global chrome
   =============================================================================

   Scope of this file:
     - brand colour tokens, mapped onto the iX classic-dark theme variables
     - global resets and scrollbar styling
     - the auth status indicator in the application header
     - the standalone login page (login.html does not load components.css)
     - read-only/guest mode

   Everything else — cards, tables, forms, buttons, badges, modals, page
   states — is defined once in assets/components.css. Do not re-add component
   rules here: components.css loads after this file, so anything duplicated
   here is dead weight, and anything that differs is drift waiting to happen.
   ========================================================================== */

:root {
    --monster-purple: #7C3AED;
    --monster-dark: #5B21B6;
    --monster-light: #A78BFA;
    --monster-green: #10B981;
    --monster-teal: #14B8A6;
    --monster-red: #EF4444;
    --monster-orange: #F97316;
    --accent-blue: #3B82F6;
    /* Map to iX classic-dark theme variables */
    --dark-bg: var(--theme-color-1, #0f1619);
    --dark-surface: var(--theme-color-2, #18262d);
    --dark-surface-2: var(--theme-color-3, #223240);
    --dark-border: var(--theme-color-soft-bdr, rgba(211, 236, 248, 0.4));
    --text-primary: var(--theme-color-std-text, #f0f6fc);
    --text-secondary: var(--theme-color-soft-text, #97bdd4);
    --text-muted: var(--theme-color-weak-text, #617d91);
    --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #10B981 100%);
    --gradient-secondary: linear-gradient(135deg, #5B21B6 0%, #14B8A6 100%);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

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

body {
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================= Auth status indicator ===================== */

.auth-status-indicator {
    position: fixed;
    top: 0.65rem;
    right: 1rem;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.18rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    pointer-events: none;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-status-indicator[hidden] {
    display: none;
}

.auth-status-readonly {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.auth-status-logged-in {
    color: #34d399;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.45);
}

.auth-status-disabled {
    color: var(--theme-color-soft-text, #97bdd4);
    background: rgba(151, 189, 212, 0.12);
    border: 1px solid rgba(151, 189, 212, 0.35);
}

@media (max-width: 720px) {
    .auth-status-indicator {
        right: 0.75rem;
        max-width: 45vw;
    }
}

/* ================================ Login page ============================= */
/* login.html is served standalone, outside the SPA shell, and loads only this
   stylesheet — so it keeps its own form primitives. */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 2rem;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.1) 0%, transparent 100%);
}

.login-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    padding: 3rem;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img {
    height: 60px;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form primitives for the login page. Inside the SPA these are superseded by
   components.css. No .btn rules here: login.html styles its own submit button
   (.login-submit), and a .btn rule in this file leaks into every SPA page —
   properties components.css does not happen to redefine (width, border) win,
   which is what made .btn-primary render full-width on the table headers. */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--monster-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #FECACA;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #A7F3D0;
}

/* ========================== Global scrollbar styling ===================== */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: var(--dark-surface);
}
::-webkit-scrollbar-thumb {
    background: var(--dark-surface-2);
    border-radius: 6px;
    border: 3px solid var(--dark-surface); /* creates padding */
}
::-webkit-scrollbar-thumb:hover {
    background: var(--dark-border);
}
::-webkit-scrollbar-thumb:active {
    background: var(--monster-purple);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--dark-surface-2) var(--dark-surface);
}

/* =============================
   Read-only / Guest Mode
   Hide all write-action controls when body has .read-only-mode
   ============================= */
.read-only-mode [data-requires-auth] {
    display: none !important;
}
