/* ===========================================================
   MIDGARD SSO — Cockpit HUD theme (Elite Dangerous inspired)
   =========================================================== */

:root {
    --hud-orange:        #ff8c1a;
    --hud-orange-bright: #ffb066;
    --hud-orange-dim:    #a85e12;
    --hud-cyan:          #5fd8ff;
    --hud-cyan-dim:      #2a7f96;
    --hud-red:           #ff3b3b;
    --hud-red-dim:       #7a1f1f;
    --hud-green:         #6dffb0;

    --bg-void:    #04060a;
    --bg-panel:   #0b0f14;
    --bg-panel-2: #0f141b;
    --bg-input:   #060a0e;

    --border-dim: rgba(255, 140, 26, 0.28);
    --border-mid: rgba(255, 140, 26, 0.55);

    --font-head: 'Orbitron', 'Eurostile', 'Segoe UI', sans-serif;
    --font-mono: 'Share Tech Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-void);
    color: var(--hud-orange);
    font-family: var(--font-mono);
    min-height: 100%;
}

body {
    position: relative;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

/* Ambient grid + vignette + scanlines */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 140, 26, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 140, 26, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 40%, transparent 90%);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0,
        rgba(0, 0, 0, 0.08) 1px,
        rgba(0, 0, 0, 0) 3px
    );
    box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.85);
}

a { color: var(--hud-cyan); text-decoration: none; }
a:hover { color: var(--hud-orange-bright); }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0;
    font-weight: 600;
}

p { margin: 0 0 10px; }

.mono { font-family: var(--font-mono); }
.dim { color: var(--hud-orange-dim); }
.cyan { color: var(--hud-cyan); }
.danger-text { color: var(--hud-red); }

/* ===================== SHELL LAYOUT ===================== */

.shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-mid);
    background: linear-gradient(180deg, rgba(255,140,26,0.06), transparent);
}

@media (max-width: 720px) {
    .topbar { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .topbar-status { justify-self: center; }
}

.topbar-center { justify-self: center; }

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start;
}

.topbar-brand .glyph {
    width: 34px;
    height: 34px;
    border: 2px solid var(--hud-orange);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 14px;
    color: var(--hud-orange-bright);
    box-shadow: 0 0 14px rgba(255,140,26,0.5);
    flex-shrink: 0;
}

.topbar-brand .title {
    font-family: var(--font-head);
    font-size: 18px;
    letter-spacing: 0.2em;
    color: var(--hud-orange-bright);
    text-shadow: 0 0 8px rgba(255,140,26,0.6);
}

.topbar-brand .subtitle {
    font-size: 11px;
    color: var(--hud-cyan-dim);
    letter-spacing: 0.15em;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
    justify-self: end;
    flex-wrap: wrap;
}

.topbar-status .stat { text-align: right; }
.topbar-status .stat .label { display: block; color: var(--hud-orange-dim); font-size: 10px; letter-spacing: 0.1em; }
.topbar-status .stat .value { display: block; color: var(--hud-cyan); font-size: 13px; }

a.stat.stat-link { text-decoration: none; transition: opacity .15s ease; }
a.stat.stat-link:hover { opacity: 0.75; }
a.stat.stat-link:hover .value { color: var(--hud-orange-bright); }

#hud-clock { color: var(--hud-orange-bright); font-variant-numeric: tabular-nums; }

.pulse-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--hud-green);
    box-shadow: 0 0 8px var(--hud-green);
    animation: pulse 2s infinite ease-in-out;
    margin-right: 6px;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ===================== BODY GRID ===================== */

.main-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 20px 24px 40px;
}

@media (max-width: 860px) {
    .main-grid { grid-template-columns: 1fr; }
}

/* ===================== NAV / MODULE LIST ===================== */

.nav-modules { display: flex; flex-direction: column; gap: 8px; }

.nav-heading {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--hud-orange-dim);
    padding: 0 4px 6px;
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 4px;
    margin-top: 12px;
}
.nav-heading:first-child { margin-top: 0; }

.mod-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-dim);
    background: rgba(255,140,26,0.03);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    color: var(--hud-orange);
    font-size: 12.5px;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all .15s ease;
    position: relative;
}

.mod-slot .idx { color: var(--hud-orange-dim); font-size: 11px; width: 18px; }

.mod-slot:hover {
    border-color: var(--hud-orange);
    background: rgba(255,140,26,0.10);
    color: var(--hud-orange-bright);
}

.mod-slot.active {
    border-color: var(--hud-cyan);
    background: rgba(95,216,255,0.10);
    color: var(--hud-cyan);
    box-shadow: 0 0 14px rgba(95,216,255,0.25);
}
.mod-slot.active .idx { color: var(--hud-cyan-dim); }

.mod-slot.offline {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--hud-orange-dim);
}
.mod-slot.offline:hover { border-color: var(--border-dim); background: rgba(255,140,26,0.03); color: var(--hud-orange-dim); }
.mod-slot.offline .tag {
    margin-left: auto;
    font-size: 9px;
    border: 1px solid var(--hud-orange-dim);
    padding: 1px 5px;
    letter-spacing: 0.1em;
}

.mod-slot.danger:hover { border-color: var(--hud-red); color: var(--hud-red); background: rgba(255,59,59,0.08); }

/* ===================== PANELS ===================== */

.hud-panel {
    border: 1px solid var(--border-mid);
    background: linear-gradient(180deg, var(--bg-panel), var(--bg-panel-2));
    clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
    margin-bottom: 20px;
    position: relative;
}

.hud-panel.panel-danger { border-color: var(--hud-red-dim); }
.hud-panel.panel-cyan { border-color: var(--hud-cyan-dim); }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-dim);
    gap: 12px;
    flex-wrap: wrap;
}

.panel-title {
    font-family: var(--font-head);
    font-size: 14px;
    letter-spacing: 0.18em;
    color: var(--hud-orange-bright);
}
.panel-cyan .panel-title { color: var(--hud-cyan); }
.panel-danger .panel-title { color: var(--hud-red); }

.panel-sub { font-size: 11px; color: var(--hud-orange-dim); letter-spacing: 0.08em; }

.panel-body { padding: 20px; }

/* ===================== PAGINATION ===================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-dim);
}
.pagination .page-indicator { font-size: 11px; color: var(--hud-orange-dim); letter-spacing: 0.08em; }
.pagination .page-jump {
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    border-bottom: 2px solid var(--hud-orange-dim);
    color: var(--hud-orange-bright);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 8px;
    outline: none;
    cursor: pointer;
}
.pagination .page-jump:focus { border-color: var(--hud-cyan); border-bottom-color: var(--hud-cyan); }

/* ===================== BUTTONS ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--hud-orange);
    color: var(--hud-orange-bright);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: all .15s ease;
}
.btn:hover { background: rgba(255,140,26,0.15); box-shadow: 0 0 12px rgba(255,140,26,0.4); color: #fff; }

.btn-cyan { border-color: var(--hud-cyan); color: var(--hud-cyan); }
.btn-cyan:hover { background: rgba(95,216,255,0.15); box-shadow: 0 0 12px rgba(95,216,255,0.4); }

.btn-danger { border-color: var(--hud-red); color: var(--hud-red); }
.btn-danger:hover { background: rgba(255,59,59,0.15); box-shadow: 0 0 12px rgba(255,59,59,0.4); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }

/* ===================== FORMS ===================== */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--hud-orange-dim);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    border-bottom: 2px solid var(--hud-orange-dim);
    color: var(--hud-orange-bright);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    transition: border-color .15s ease;
}
.field input:focus,
.field select:focus {
    border-color: var(--hud-cyan);
    border-bottom-color: var(--hud-cyan);
    box-shadow: 0 0 10px rgba(95,216,255,0.2);
}
.field .hint { font-size: 11px; color: var(--hud-cyan-dim); margin-top: 5px; }

form { max-width: 460px; }
form.wide { max-width: none; }

/* ===================== TABLES ===================== */

.hud-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hud-table th {
    text-align: left;
    font-family: var(--font-head);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    color: var(--hud-orange-dim);
    border-bottom: 1px solid var(--border-mid);
    padding: 8px 10px;
    text-transform: uppercase;
}
.hud-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255,140,26,0.10);
    color: var(--hud-orange);
    vertical-align: middle;
}
.hud-table tr:hover td { background: rgba(255,140,26,0.05); }
.hud-table .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===================== BADGES / PILLS ===================== */

.pill {
    display: inline-block;
    padding: 2px 9px;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    border: 1px solid currentColor;
    text-transform: uppercase;
}
.pill-active { color: var(--hud-green); }
.pill-suspended { color: var(--hud-red); }
.pill-role { color: var(--hud-cyan); }

/* ===================== ALERTS / FLASH ===================== */

.alert {
    padding: 12px 18px;
    border: 1px solid var(--hud-orange);
    background: rgba(255,140,26,0.08);
    color: var(--hud-orange-bright);
    margin-bottom: 18px;
    font-size: 13px;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}
.alert-success { border-color: var(--hud-green); color: var(--hud-green); background: rgba(109,255,176,0.08); }
.alert-danger { border-color: var(--hud-red); color: var(--hud-red); background: rgba(255,59,59,0.08); }
.alert-info { border-color: var(--hud-cyan); color: var(--hud-cyan); background: rgba(95,216,255,0.08); }

/* ===================== STAT TILES ===================== */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.tile {
    border: 1px solid var(--border-dim);
    background: rgba(255,140,26,0.03);
    padding: 16px 18px;
    clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 12px);
}
.tile .tile-label { font-size: 10.5px; color: var(--hud-orange-dim); letter-spacing: 0.14em; text-transform: uppercase; }
.tile .tile-value { font-family: var(--font-head); font-size: 30px; color: var(--hud-cyan); margin-top: 6px; }

/* ===================== APPLICATION LAUNCHER ===================== */

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 16px;
}
.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    text-decoration: none;
    border: 1px solid var(--border-dim);
    background: rgba(255,140,26,0.03);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all .15s ease;
}
.app-tile:hover {
    border-color: var(--hud-orange);
    background: rgba(255,140,26,0.10);
    box-shadow: 0 0 14px rgba(255,140,26,0.25);
}
.app-tile .app-icon-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--border-mid);
}
.app-tile .app-icon-fallback {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hud-orange);
    color: var(--hud-orange-bright);
    font-family: var(--font-head);
    font-size: 20px;
    background: rgba(255,140,26,0.08);
}
.app-tile .app-label {
    font-size: 11px;
    color: var(--hud-orange);
    text-align: center;
    letter-spacing: 0.03em;
    word-break: break-word;
}

/* ===================== LOGIN PAGE ===================== */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 20px;
}
.login-panel { width: 100%; max-width: 400px; }
.login-panel .panel-body { padding: 28px 24px; }
.login-title {
    text-align: center;
    margin-bottom: 22px;
}
.login-title .glyph {
    width: 54px; height: 54px;
    margin: 0 auto 12px;
    border: 2px solid var(--hud-orange);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head);
    font-size: 22px;
    color: var(--hud-orange-bright);
    box-shadow: 0 0 20px rgba(255,140,26,0.5);
}
.login-title h1 { font-size: 16px; color: var(--hud-orange-bright); }
.login-title p { font-size: 11px; color: var(--hud-cyan-dim); margin-top: 4px; letter-spacing: 0.15em; }

.boot-lines {
    font-size: 10.5px;
    color: var(--hud-orange-dim);
    line-height: 1.6;
    margin-top: 18px;
    border-top: 1px solid var(--border-dim);
    padding-top: 12px;
}

/* ===================== MISC ===================== */

.empty-state { padding: 30px; text-align: center; color: var(--hud-orange-dim); font-size: 13px; letter-spacing: 0.05em; }

.breadcrumb { font-size: 11px; color: var(--hud-orange-dim); letter-spacing: 0.1em; margin-bottom: 14px; }
.breadcrumb .cur { color: var(--hud-cyan); }

.divider { height: 1px; background: var(--border-dim); margin: 18px 0; }

footer.shell-footer {
    text-align: center;
    padding: 14px;
    font-size: 10.5px;
    color: var(--hud-orange-dim);
    letter-spacing: 0.15em;
    border-top: 1px solid var(--border-dim);
    position: relative;
    z-index: 1;
}

::selection { background: var(--hud-orange); color: #000; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-void); }
::-webkit-scrollbar-thumb { background: var(--hud-orange-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--hud-orange); }
