/* ===========================================================================
   Eclyra Admin — "Arcane" dark theme
   =========================================================================== */

:root {
    --bg:        #090c15;
    --bg-2:      #0d1220;
    --surface:   #141b2d;
    --surface-2: #1a2238;
    --border:    #283149;
    --border-2:  #323d59;
    --text:      #e7ebf5;
    --muted:     #8b94ad;
    --accent:    #7c5cff;
    --accent-2:  #36d1dc;
    --gold:      #e8b65a;
    --danger:    #ff5c7c;
    --success:   #38d39f;
    --brand-grad: linear-gradient(135deg, #7c5cff 0%, #36d1dc 100%);
    --radius: 14px;
    --shadow: 0 10px 30px -12px rgba(0,0,0,.6);
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    letter-spacing: .1px;
}

/* ambient glows */
body::before {
    content: "";
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(900px 600px at -5% -10%, rgba(124,92,255,.18), transparent 60%),
        radial-gradient(800px 500px at 105% 0%, rgba(54,209,220,.12), transparent 55%),
        var(--bg);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #6ee7f0; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: .2px; }
h1 { font-size: 1.7rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px; flex: 0 0 256px;
    background: linear-gradient(180deg, #0e1322 0%, #0a0e19 100%);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}

.app-main { flex: 1; min-width: 0; }
.content { padding: 2rem 2.4rem; max-width: 1200px; }

/* ---------- Brand ---------- */
.brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.4rem 1.3rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--brand-grad);
    box-shadow: 0 6px 18px -6px rgba(124,92,255,.7);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name {
    font-family: 'Cinzel', serif; font-weight: 700;
    font-size: 1.32rem; letter-spacing: 2px;
    background: var(--brand-grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: .66rem; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }

/* ---------- Nav ---------- */
.nav-section { padding: 1rem .8rem; flex: 1; }
.nav-label { font-size: .68rem; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: .3rem .8rem .6rem; }
.nav-item-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .62rem .85rem; margin-bottom: .25rem;
    border-radius: 10px; color: var(--muted); font-weight: 500;
    transition: all .15s ease; position: relative;
}
.nav-item-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item-link.active {
    color: #fff; background: rgba(124,92,255,.14);
    box-shadow: inset 0 0 0 1px rgba(124,92,255,.3);
}
.nav-item-link.active::before {
    content: ""; position: absolute; left: -.8rem; top: 18%; bottom: 18%;
    width: 3px; border-radius: 3px; background: var(--brand-grad);
}
.nav-item-link .ic { width: 18px; height: 18px; opacity: .9; }

/* ---------- Sidebar footer (user) ---------- */
.side-footer { padding: .9rem 1rem 1.2rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand-grad); display: grid; place-items: center;
    font-weight: 700; color: #fff; font-size: .9rem;
}
.user-name { font-weight: 600; font-size: .9rem; line-height: 1.1; }
.user-role { font-size: .72rem; color: var(--gold); letter-spacing: .5px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
}
.card-title { font-weight: 700; }

/* stat cards */
.stat-card {
    position: relative; overflow: hidden;
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.4rem 1.5rem;
    transition: transform .18s ease, border-color .18s ease;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-2); }
.stat-card .stat-ic {
    width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
    background: rgba(124,92,255,.16); margin-bottom: .9rem;
}
.stat-card .stat-ic svg { width: 22px; height: 22px; }
.stat-value { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--muted); margin-top: .35rem; font-size: .9rem; letter-spacing: .3px; }
.stat-card.accent-gold .stat-ic { background: rgba(232,182,90,.16); }
.stat-card.accent-danger .stat-ic { background: rgba(255,92,124,.16); }
.stat-card::after {
    content: ""; position: absolute; right: -30px; top: -30px;
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124,92,255,.15), transparent 70%);
}

/* ---------- Tables ---------- */
.table { color: var(--text); border-color: var(--border); }
.table > :not(caption) > * > * { background: transparent; border-color: var(--border); padding: .8rem .9rem; }
.table thead th {
    color: var(--muted); font-weight: 600; font-size: .76rem;
    text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border-2);
}
.data-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-card .table { margin: 0; }
.table-hover > tbody > tr { transition: background .12s ease; }
.table-hover > tbody > tr:hover > * { background: rgba(124,92,255,.08); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; letter-spacing: .4px; padding: .4em .7em; border-radius: 7px; }
.badge.bg-secondary { background: rgba(255,255,255,.08) !important; color: #cfd6e6; }
.badge.bg-success   { background: rgba(56,211,159,.16) !important; color: var(--success); }
.badge.bg-danger    { background: rgba(255,92,124,.16) !important; color: var(--danger); }
.role-badge { background: rgba(124,92,255,.16); color: #b6a6ff; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 10px; letter-spacing: .2px; }
.btn-primary {
    background: var(--brand-grad); border: none; color: #fff;
    box-shadow: 0 8px 20px -8px rgba(124,92,255,.7);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; }
.btn-outline-primary { color: var(--accent-2); border-color: var(--border-2); }
.btn-outline-primary:hover { background: rgba(124,92,255,.12); border-color: var(--accent); color: #fff; }
.btn-outline-secondary { color: var(--muted); border-color: var(--border-2); }
.btn-outline-secondary:hover { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--border-2); }
.btn-outline-light { color: var(--muted); border-color: var(--border); }
.btn-outline-light:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ---------- Forms ---------- */
.form-control {
    background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
    border-radius: 10px; padding: .6rem .85rem;
}
.form-control:focus {
    background: var(--bg-2); color: var(--text);
    border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(124,92,255,.25);
}
.form-control::placeholder { color: #5c6680; }
.form-label { color: var(--muted); font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.input-group .btn { border-radius: 0 10px 10px 0; }
.input-group .form-control { border-radius: 10px 0 0 10px; }

.alert-danger { background: rgba(255,92,124,.12); border: 1px solid rgba(255,92,124,.3); color: #ffb3c2; border-radius: 10px; }
.alert-warning { background: rgba(232,182,90,.12); border: 1px solid rgba(232,182,90,.3); color: var(--gold); border-radius: 10px; }

code { color: var(--accent-2); }
dt { color: var(--muted); font-weight: 500; }
.text-muted { color: var(--muted) !important; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
}
.login-card {
    width: 400px; max-width: 100%;
    background: rgba(20,27,45,.7);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-2);
    border-radius: 20px; padding: 2.4rem 2.2rem;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.05);
}
.login-brand { text-align: center; margin-bottom: 1.8rem; }
.login-brand .brand-mark { width: 56px; height: 56px; margin: 0 auto .9rem; border-radius: 16px; }
.login-brand .brand-mark svg { width: 32px; height: 32px; }
.login-brand .brand-name { font-size: 1.9rem; }

/* ---------- Misc ---------- */
.page-head { margin-bottom: 1.6rem; }
.page-head .sub { color: var(--muted); font-size: .92rem; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    box-sizing: border-box;
    background: #1a2238; color: var(--text); border-top: 1px solid var(--border-2);
    box-shadow: 0 -4px 20px rgba(0,0,0,.5); padding: .8rem 1.2rem;
}
#blazor-error-ui .reload { color: var(--accent-2); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .9rem; top: .55rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: #fff; border-radius: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex: none; flex-direction: row; flex-wrap: wrap; }
    .nav-section { display: flex; gap: .4rem; align-items: center; padding: .6rem; flex: 1 1 100%; }
    .nav-label { display: none; }
    .nav-item-link { margin: 0; }
    .nav-item-link.active::before { display: none; }
    .side-footer { border-top: none; }
    .content { padding: 1.3rem; }
}
