/* ════════════════════════════════════════════════════════════════════════
   site.css — IT Support Portal (dark-only design system)

   This file establishes the layout shell, sidebar, topbar, landing page,
   and all generic utility classes.  Theme-specific colours come from
   forge.custom.css or skywatch.custom.css, which override the CSS
   variables defined here and in the base (darkly) bundle.
   ════════════════════════════════════════════════════════════════════════ */

@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ── CSS variable defaults (Forge look — overridden by Skywatch if active) ─ */
:root {
    --surface:        #0d1117;
    --surface-alt:    #161b22;
    --surface-raised: #1b2230;
    --surface-hover:  #20293a;

    --accent:         #00d4ff;
    --accent-hover:   #33ddff;
    --accent-soft:    rgba(0, 212, 255, 0.12);
    --accent-border:  rgba(0, 212, 255, 0.35);

    --border:         #2a3244;
    --border-strong:  #3a4459;
    --text:           #e6edf3;
    --text-muted:     #8b949e;
    --text-light:     #6e7681;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    --shadow-sm:   0 1px 3px  rgba(0, 0, 0, 0.4);
    --shadow:      0 2px 10px rgba(0, 0, 0, 0.55);
    --shadow-lg:   0 12px 32px rgba(0, 0, 0, 0.7);

    --transition:  0.15s ease;
    --sidebar-w:   260px;
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface);
    overscroll-behavior-y: contain;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.6em;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
}

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

/* ── Page layout shell ─────────────────────────────────────────────────── */
.page {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-topbar {
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.2px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.topbar-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.topbar-link:hover { color: var(--accent); background: var(--surface-hover); text-decoration: none; }

.content {
    padding: 28px 32px;
    flex: 1;
    min-width: 0;
}

/* ── Sidebar (portal-sidebar root applied by NavMenu.razor) ───────────── */
.portal-sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 18px 14px 14px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.sidebar-logo-img { width: 36px; height: 36px; border-radius: var(--radius-sm); object-fit: contain; }
.sidebar-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-border);
}

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.sidebar-brand-name { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: 0.2px; }
.sidebar-brand-tag  { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 3px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
    padding: 4px 12px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 2px;
}

/*  NavLink renders <a> without the component's scoped CSS attribute,
    so these rules are intentionally NOT scoped and use high specificity
    to outrank the bootstrap bundle.  */
.portal-sidebar .nav-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin: 0 0 1px;
    border-radius: var(--radius-sm);
    color: var(--text-muted) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.portal-sidebar .nav-link-item:hover {
    color: var(--text) !important;
    background: var(--surface-hover);
    text-decoration: none !important;
}
.portal-sidebar .nav-link-item.active {
    color: var(--accent) !important;
    background: var(--accent-soft);
    border-left-color: var(--accent);
    font-weight: 600;
}

.portal-sidebar .nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
}
.portal-sidebar .nav-icon svg { width: 18px; height: 18px; }
.portal-sidebar .nav-label { flex: 1; min-width: 0; }

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 10px;
}

.sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    display: grid; place-items: center;
    font-size: 13px;
    flex: 0 0 32px;
    border: 1px solid var(--accent-border);
}

.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.sidebar-user-name { font-size: 13px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.sidebar-user-link { font-size: 11px; color: var(--text-muted); text-decoration: none; margin-top: 2px; }
.sidebar-user-link:hover { color: var(--accent); }

.sidebar-logout-form { margin: 0; }
.sidebar-logout-btn,
.sidebar-login-btn,
.sidebar-register-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.sidebar-logout-btn:hover,
.sidebar-login-btn:hover,
.sidebar-register-btn:hover {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

/* ── Landing page (unauthenticated Index.razor) ─────────────────────── */
.landing-page {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 24px;
}

.landing-hero {
    text-align: center;
    padding: 48px 20px 56px;
    background:
        radial-gradient(ellipse at top, var(--accent-soft) 0%, transparent 60%),
        var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.landing-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.landing-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 14px;
    color: var(--text);
}

.landing-sub {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto 30px;
}

.landing-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-landing-primary,
.btn-landing-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none !important;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-landing-primary {
    background: var(--accent);
    color: #001016;
    border-color: var(--accent);
}
.btn-landing-primary:hover {
    background: var(--accent-hover);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-soft);
}

.btn-landing-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-landing-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.landing-footer {
    margin-top: 28px;
    font-size: 12px;
    color: var(--text-light);
}

/* Feature cards grid */
.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}
.feature-card:hover {
    border-color: var(--accent-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    margin-bottom: 14px;
    border: 1px solid var(--accent-border);
}

.feature-title { font-size: 18px; margin: 0 0 8px; color: var(--text); }
.feature-desc  { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.55; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-w: 220px; }
    .landing-title { font-size: 32px; }
    .landing-sub { font-size: 16px; }
    .content { padding: 18px; }
}
@media (max-width: 640px) {
    .page { grid-template-columns: 1fr; }
    .sidebar { display: none; } /* mobile: hide for now — mobile nav out of scope */
    .main-topbar { padding: 0 14px; }
    .content { padding: 14px; }
    .landing-hero { padding: 28px 14px 32px; }
    .landing-title { font-size: 26px; }
}

/* ── Blazor error banner (default is ugly) ─────────────────────────────── */
#blazor-error-ui {
    background: #f85149;
    color: #fff;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.4);
    display: none;
    padding: 10px 20px;
    position: fixed;
    z-index: 1000;
    font-size: 13px;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 12px;
    top: 8px;
    color: #fff;
}
/* ── Blazor reconnect overlay (prevents white flash on disconnect) ────── */
/* The #components-reconnect-modal div is injected by Blazor framework     */
/* and defaults to a plain white overlay — we override with theme colors.  */

#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow: hidden;
    background-color: #0d1117;   /* --surface fallback (forge dark) */
    background-color: var(--surface, #0d1117);
    color: #e6edf3;
    color: var(--text, #e6edf3);
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* Inner content wrapper */
#components-reconnect-modal .reconnect-container,
#components-reconnect-modal > div {
    background-color: #161b22;
    background-color: var(--surface-alt, #161b22);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border: 1px solid var(--accent-border, rgba(0, 212, 255, 0.35));
    border-radius: 10px;
    padding: 28px 36px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.7));
}

#components-reconnect-modal h5,
#components-reconnect-modal p,
#components-reconnect-modal div {
    color: #e6edf3;
    color: var(--text, #e6edf3);
}

/* Spinner for reconnecting state */
#components-reconnect-modal.components-reconnect-show::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-top-color: var(--accent, #00d4ff);
    border-radius: 50%;
    animation: reconnect-spin 0.9s linear infinite;
    margin-bottom: 8px;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

/* Reconnect message text */
#components-reconnect-modal.components-reconnect-show::after {
    content: 'Reconnecting to server...';
    color: #8b949e;
    color: var(--text-muted, #8b949e);
    font-size: 14px;
}

/* Failed state */
#components-reconnect-modal.components-reconnect-failed {
    background-color: rgba(13, 17, 23, 0.97);
    background-color: rgba(var(--surface-rgb, 13, 17, 23), 0.97);
}

/* Reload button (shown in failed/rejected state) */
#components-reconnect-modal button,
#components-reconnect-modal a {
    background-color: #00d4ff;
    background-color: var(--accent, #00d4ff);
    color: #001016;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 8px;
    display: inline-block;
}

#components-reconnect-modal button:hover,
#components-reconnect-modal a:hover {
    background-color: #33ddff;
    background-color: var(--accent-hover, #33ddff);
}
