/*
    filename        : /mnt/www/live/bsodcloud.com/assets/css/app.css
    Last Updated    : 2026-03-12 00:20
    Version         : 1.00
    purpose         : Global BSODCloud application styles for layout, shell, typography, forms, cards, tables, buttons, auth pages, and shared admin indicators.
*/

:root{
    --bg: #0f172a;
    --bg-soft: #111827;
    --panel: #1f2937;
    --panel-2: #243041;
    --text: #e5e7eb;
    --text-soft: #cbd5e1;
    --text-dim: #94a3b8;
    --border: #334155;
    --accent: #38bdf8;
    --accent-2: #0ea5e9;
    --success-bg: #0f2e1d;
    --success-border: #1f6f46;
    --success-text: #bbf7d0;
    --warn-bg: #3a2a05;
    --warn-border: #9a6b00;
    --warn-text: #fde68a;
    --danger-bg: #3b1212;
    --danger-border: #7f1d1d;
    --danger-text: #fecaca;
    --shadow: 0 10px 30px rgba(0,0,0,0.28);
    --radius: 14px;
    --radius-sm: 10px;
    --topbar-height: 64px;
    --sidebar-width: 270px;
    --content-width: 1400px;
    --font-stack: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html{
    font-size: 16px;
}

body{
    margin: 0;
    background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
    color: var(--text);
    font-family: var(--font-stack);
    line-height: 1.5;
    min-height: 100vh;
}

img{
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover{
    color: #7dd3fc;
    text-decoration: underline;
}

button,
input,
select,
textarea{
    font: inherit;
}

button{
    cursor: pointer;
}

h1,
h2,
h3,
h4{
    margin-top: 0;
    color: #f8fafc;
    line-height: 1.2;
}

h1{
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 0.5rem;
}

h2{
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 0.75rem;
}

p{
    margin-top: 0;
}

code{
    background: rgba(148,163,184,0.12);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 6px;
    padding: 0.1rem 0.35rem;
    color: #f8fafc;
}

.app-shell{
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar{
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(148,163,184,0.14);
    box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}

.menu-toggle{
    border: 1px solid var(--border);
    background: #162033;
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover{
    background: #1d2a42;
}

.app-brand{
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.02em;
}

.app-topbar-spacer{
    flex: 1 1 auto;
}

.app-topbar-right{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-user-label{
    color: var(--text-soft);
    font-weight: 600;
    white-space: nowrap;
}

.app-topbar-link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #172233;
    color: #f8fafc;
    text-decoration: none;
    font-weight: 600;
}

.app-topbar-link:hover{
    background: #203149;
    text-decoration: none;
    color: #ffffff;
}

.admin-mode-label{
    display:inline-flex;
    align-items:center;
    min-height:36px;
    padding:0 12px;
    border-radius:999px;
    background:#b91c1c;
    color:#ffffff;
    font-size:0.85rem;
    font-weight:700;
    letter-spacing:0.03em;
    white-space:nowrap;
}

.admin-exit-button{
    min-height:36px;
    padding:0 12px;
    border-radius:999px;
    border:1px solid #ca8a04;
    background:#facc15;
    color:#000000;
    font-weight:700;
    cursor:pointer;
    transition:background 0.15s ease;
}

.admin-exit-button:hover{
    background: #eab308;
}

.app-sidebar{
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 86vw);
    background: #0f172a;
    border-right: 1px solid rgba(148,163,184,0.14);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1100;
    overflow-y: auto;
    padding: 16px;
}

.app-sidebar.open{
    transform: translateX(0);
}

.app-backdrop{
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    background: rgba(2,6,23,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1050;
}

.app-backdrop.open{
    opacity: 1;
    pointer-events: auto;
}

.menu-section{
    margin-bottom: 18px;
}

.menu-section-title{
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.menu-item{
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--text-soft);
    text-decoration: none;
}

.menu-item:hover{
    background: rgba(56,189,248,0.08);
    color: #ffffff;
    text-decoration: none;
}

.menu-item.external .ext-mark{
    margin-left: 6px;
    opacity: 0.7;
}

.app-content{
    width: min(100%, var(--content-width));
    margin: 0 auto;
    padding: 20px 16px 48px;
    flex: 1 1 auto;
}

.page-section{
    margin-bottom: 18px;
}

.card{
    background: linear-gradient(180deg, rgba(31,41,55,0.95) 0%, rgba(23,32,46,0.98) 100%);
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.hint{
    color: var(--text-dim);
    font-size: 0.94rem;
}

.error,
.message,
.notice,
.admin-banner{
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid transparent;
    margin-bottom: 14px;
}

.error{
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.message,
.notice{
    background: rgba(14,165,233,0.12);
    border-color: rgba(14,165,233,0.28);
    color: #bae6fd;
}

.admin-banner{
    background: rgba(56,189,248,0.1);
    border-color: rgba(56,189,248,0.25);
    color: #dbeafe;
}

.admin-banner-warning{
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-text);
}

form{
    margin: 0;
}

.form-row{
    margin-bottom: 14px;
}

.form-actions{
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

label,
.form-label{
    display: block;
    margin-bottom: 6px;
    color: var(--text-soft);
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea,
.form-select{
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0f172a;
    color: #f8fafc;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea{
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.form-select:focus{
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56,189,248,0.16);
}

input::placeholder,
textarea::placeholder{
    color: #64748b;
}

.checkbox-row label{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-weight: 500;
}

button,
.button-link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--accent-2);
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.05s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover,
.button-link:hover{
    text-decoration: none;
    color: #ffffff;
    opacity: 0.96;
}

button:active,
.button-link:active{
    transform: translateY(1px);
}

button.secondary,
.button-link.secondary{
    background: #172233;
    border-color: var(--border);
    color: #f8fafc;
}

button.secondary:hover,
.button-link.secondary:hover{
    background: #203149;
}

table{
    width: 100%;
    border-collapse: collapse;
}

th,
td{
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(148,163,184,0.12);
    vertical-align: top;
}

th{
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 700;
}

td{
    color: var(--text-soft);
}

.page-auth{
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 24px;
}

.auth-card{
    width: min(100%, 520px);
}

.auth-form{
    display: block;
}

.signal-reply-status{
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(56,189,248,0.08);
    border: 1px solid rgba(56,189,248,0.2);
    color: #bae6fd;
}

.auth-card h1{
    margin-bottom: 8px;
}

.auth-card .hint{
    margin-top: 10px;
}

.theme-light{
    --bg: #f8fafc;
    --bg-soft: #f1f5f9;
    --panel: #ffffff;
    --panel-2: #ffffff;
    --text: #0f172a;
    --text-soft: #334155;
    --text-dim: #64748b;
    --border: #dbe2ea;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: var(--text);
}

.theme-light body{
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: var(--text);
}

.theme-light .app-topbar{
    background: rgba(255,255,255,0.96);
    border-bottom-color: rgba(15,23,42,0.08);
}

.theme-light .app-brand,
.theme-light h1,
.theme-light h2,
.theme-light h3,
.theme-light h4{
    color: #0f172a;
}

.theme-light .app-user-label,
.theme-light .hint,
.theme-light td,
.theme-light p{
    color: #334155;
}

.theme-light .app-topbar-link,
.theme-light .menu-toggle,
.theme-light button.secondary,
.theme-light .button-link.secondary{
    background: #ffffff;
    color: #0f172a;
    border-color: #dbe2ea;
}

.theme-light .card{
    background: #ffffff;
    border-color: #e2e8f0;
}

.theme-light .app-sidebar{
    background: #ffffff;
    border-right-color: #e2e8f0;
}

.theme-light .menu-item{
    color: #334155;
}

.theme-light .menu-item:hover{
    background: rgba(14,165,233,0.08);
    color: #0f172a;
}

.theme-light input[type="text"],
.theme-light input[type="email"],
.theme-light input[type="password"],
.theme-light input[type="search"],
.theme-light input[type="number"],
.theme-light select,
.theme-light textarea,
.theme-light .form-select{
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
}

.theme-light code{
    background: rgba(15,23,42,0.05);
    color: #0f172a;
}

@media (min-width: 980px){
    .app-content{
        padding: 26px 24px 54px;
    }

    .card{
        padding: 22px;
    }
}

@media (max-width: 760px){
    .app-topbar{
        padding: 0 12px;
        gap: 10px;
    }

    .app-topbar-right{
        display:flex;
        align-items:center;
        gap:12px;
    }

    .app-user-label{
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .admin-mode-label{
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-content{
        padding: 16px 12px 36px;
    }

    .card{
        padding: 16px;
        border-radius: 12px;
    }

    th,
    td{
        padding: 10px 8px;
    }
}

@media (max-width: 560px){
    .app-topbar{
        min-height: auto;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
        align-items: flex-start;
    }

    .app-brand{
        padding-top: 8px;
    }

    .app-topbar-right{
        width: 100%;
        justify-content: flex-start;
    }

    .form-actions{
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .button-link,
    .app-topbar-link{
        width: 100%;
    }

    .admin-exit-button{
        width: auto;
    }
}
body.impersonation-mode{
    --accent-color:#b91c1c;
}