/* =========================
   Navo Layout
   App shell, sidebar, topbar, content, page headers, mobile sidebar

   Domain-only layout.
   Global cards, buttons, tables, badges live in components.css.
   Auth layout lives in forms.css.
========================= */

/* =========================
   App Shell
========================= */

.app-layout,
.app-shell,
.layout,
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* =========================
   Sidebar
========================= */

.sidebar {
    background:
        radial-gradient(circle at 18% 8%, rgba(45, 212, 191, 0.12), transparent 30%),
        radial-gradient(circle at 80% 18%, rgba(129, 140, 248, 0.10), transparent 34%),
        rgba(15, 23, 42, 0.90);
    border-right: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow:
        18px 0 60px rgba(0, 0, 0, 0.22),
        inset -1px 0 0 rgba(255, 255, 255, 0.035);
    color: #ffffff;
    flex: 0 0 var(--sidebar-width);
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    width: var(--sidebar-width);
    z-index: 30;
}

.sidebar-brand,
.sidebar h1,
.sidebar .brand {
    color: #ffffff;
    font-family: Outfit, Inter, sans-serif;
    font-size: 21px;
    font-weight: 950;
    letter-spacing: -0.055em;
    margin: 0 0 28px;
    padding: 0 6px;
}

.sidebar-brand a {
    align-items: center;
    color: #ffffff;
    display: inline-flex;
    gap: 10px;
    text-decoration: none;
}

.sidebar-brand a::before {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    border-radius: 11px;
    box-shadow: 0 0 24px rgba(45, 212, 191, 0.22);
    color: #020617;
    content: "FP";
    display: inline-flex;
    font-family: Outfit, Inter, sans-serif;
    font-size: 11px;
    font-weight: 950;
    height: 30px;
    justify-content: center;
    letter-spacing: -0.04em;
    width: 30px;
}

.sidebar-section {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.sidebar-title {
    color: rgba(148, 163, 184, 0.72);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.10em;
    margin: 0 0 6px 12px;
    text-transform: uppercase;
}

.sidebar a {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 14px;
    color: rgba(226, 232, 240, 0.80);
    display: flex;
    font-size: 14px;
    font-weight: 800;
    gap: 10px;
    min-height: 40px;
    padding: 10px 12px;
    text-decoration: none;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar a.active {
    background:
        linear-gradient(135deg, rgba(45, 212, 191, 0.14), rgba(129, 140, 248, 0.12)),
        rgba(255, 255, 255, 0.08);
    border-color: rgba(45, 212, 191, 0.20);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 12px 34px rgba(0, 0, 0, 0.18);
    color: #ffffff;
}

.sidebar-bottom {
    margin-top: 22px;
}

/* =========================
   Main Shell
========================= */

.main-wrapper {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
}

/* =========================
   Topbar
========================= */

.topbar {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.80)),
        rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-height: 72px;
    padding: 18px 32px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h2 {
    color: #ffffff;
    font-family: Outfit, Inter, sans-serif;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.035em;
    margin: 0;
}

.topbar-left {
    min-width: 0;
}

/* =========================
   Content Area
========================= */

.content-area,
.main-content,
.page-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 32px;
    width: 100%;
}

.content-area {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: none;
}

.content-area > * {
    margin-top: 0;
    margin-bottom: 0;
}

/* =========================
   Page Headers / Hero Cards
========================= */

.page-header,
.dashboard-header,
.dashboard-hero,
.hero-header,
.admin-header,
.admin-hero-card,
.settings-page-header,
.fac-hero {
    align-items: flex-start;
    background:
        radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.16), transparent 28%),
        radial-gradient(circle at 12% 92%, rgba(45, 212, 191, 0.08), transparent 30%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(37, 99, 235, 0.68), rgba(129, 140, 248, 0.46));
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 30px;
    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-height: 190px;
    overflow: hidden;
    padding: 42px 36px;
    position: relative;
}

.page-header::after,
.dashboard-header::after,
.dashboard-hero::after,
.hero-header::after,
.admin-header::after,
.admin-hero-card::after,
.settings-page-header::after,
.fac-hero::after {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 64%);
    content: "";
    height: 290px;
    pointer-events: none;
    position: absolute;
    right: -96px;
    top: -116px;
    width: 290px;
}

.page-header > *,
.dashboard-header > *,
.dashboard-hero > *,
.hero-header > *,
.admin-header > *,
.admin-hero-card > *,
.settings-page-header > *,
.fac-hero > * {
    position: relative;
    z-index: 1;
}

.page-header h1,
.dashboard-header h1,
.dashboard-hero h1,
.hero-header h1,
.admin-header h1,
.admin-hero-card h1,
.settings-page-header h1,
.fac-hero h1,
.page-title {
    color: #ffffff;
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(42px, 5vw, 64px);
    font-weight: 950;
    letter-spacing: -0.08em;
    line-height: 0.98;
    margin: 0;
    max-width: 920px;
}

.page-header p,
.dashboard-header p,
.dashboard-hero p,
.hero-header p,
.admin-header p,
.admin-hero-card p,
.settings-page-header p,
.fac-hero p,
.page-subtitle {
    color: #dbeafe;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.55;
    margin: 0;
    max-width: 820px;
}

.page-header .eyebrow,
.dashboard-header .eyebrow,
.dashboard-hero .eyebrow,
.hero-header .eyebrow,
.admin-header .eyebrow,
.admin-hero-card .eyebrow,
.settings-page-header .eyebrow,
.fac-hero .eyebrow {
    color: var(--primary);
}

/* =========================
   Legacy Header Fallback
   For templates that still use naked h1 + p at the top.
========================= */

.content-area > h1:first-child {
    background:
        radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(37, 99, 235, 0.68), rgba(129, 140, 248, 0.46));
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-bottom: 0;
    border-radius: 30px 30px 0 0;
    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(42px, 5vw, 64px);
    font-weight: 950;
    letter-spacing: -0.08em;
    line-height: 0.98;
    margin: 0;
    padding: 42px 36px 10px;
}

.content-area > h1:first-child + p {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(37, 99, 235, 0.68), rgba(129, 140, 248, 0.46));
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-top: 0;
    border-radius: 0 0 30px 30px;
    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    color: #dbeafe;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.55;
    margin: -28px 0 0;
    max-width: none;
    padding: 0 36px 38px;
}

/* =========================
   Mobile Sidebar
========================= */

.sidebar-toggle,
.sidebar-close,
.sidebar-backdrop {
    display: none;
}

@media (max-width: 1020px) {
    .app-layout,
    .app-shell,
    .layout,
    .dashboard-layout {
        display: flex;
        flex-direction: row;
        min-height: 100vh;
        width: 100%;
    }

    .sidebar {
        display: block;
        height: 100vh;
        left: 0;
        max-width: 340px;
        min-height: 100vh;
        overflow-y: auto;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        width: min(340px, 86vw);
        z-index: 1001;
    }

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

    .main-wrapper {
        flex: 1 1 auto;
        min-height: 100vh;
        min-width: 0;
        width: 100%;
    }

    .topbar {
        align-items: center;
        display: flex;
        gap: 10px;
        justify-content: flex-start;
        min-width: 0;
        overflow: visible;
        padding-left: 20px;
        padding-right: 20px;
        position: sticky;
        top: 0;
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }

    .topbar-left h2 {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-toggle {
        align-items: center;
        background: var(--primary);
        border: 1px solid rgba(45, 212, 191, 0.42);
        border-radius: 10px;
        box-shadow: 0 12px 28px rgba(45, 212, 191, 0.16);
        color: #020617;
        cursor: pointer;
        display: inline-flex;
        flex: 0 0 34px;
        font-size: 17px;
        font-weight: 950;
        height: 34px;
        justify-content: center;
        line-height: 1;
        margin: 0;
        min-height: 34px;
        min-width: 34px;
        opacity: 1;
        padding: 0;
        position: relative;
        transform: none;
        visibility: visible;
        width: 34px;
        z-index: 2000;
    }

    .sidebar-close {
        align-items: center;
        background: rgba(255, 255, 255, 0.10);
        border: 1px solid rgba(255, 255, 255, 0.10);
        border-radius: 10px;
        color: #ffffff;
        cursor: pointer;
        display: none;
        font-size: 20px;
        font-weight: 950;
        height: 32px;
        justify-content: center;
        line-height: 1;
        padding: 0;
        position: absolute;
        right: 14px;
        top: 18px;
        width: 32px;
        z-index: 5;
    }

    .sidebar-brand {
        padding-right: 44px;
    }

    .sidebar-backdrop {
        backdrop-filter: blur(4px);
        background: rgba(2, 6, 23, 0.66);
        bottom: 0;
        display: block;
        left: 0;
        opacity: 0;
        pointer-events: none;
        position: fixed;
        right: 0;
        top: 0;
        transition: opacity 0.24s ease;
        z-index: 1000;
    }

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

    body.sidebar-open .sidebar-toggle {
        display: none;
    }

    body.sidebar-open .sidebar-close {
        display: inline-flex;
    }
}

@media (min-width: 1021px) {
    .sidebar-toggle,
    .sidebar-close,
    .sidebar-backdrop {
        display: none;
    }

    .sidebar {
        transform: none;
    }
}

/* =========================
   Responsive Layout
========================= */

@media (max-width: 820px) {
    .page-header,
    .dashboard-header,
    .dashboard-hero,
    .hero-header,
    .admin-header,
    .admin-hero-card,
    .settings-page-header,
    .fac-hero {
        border-radius: 24px;
        min-height: 0;
        padding: 28px;
    }

    .page-header h1,
    .dashboard-header h1,
    .dashboard-hero h1,
    .hero-header h1,
    .admin-header h1,
    .admin-hero-card h1,
    .settings-page-header h1,
    .fac-hero h1,
    .page-title,
    .content-area > h1:first-child {
        font-size: clamp(34px, 10vw, 48px);
    }
}

@media (max-width: 760px) {
    .content-area,
    .main-content,
    .page-content {
        padding: 22px 18px;
    }

    .page-header,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}