@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    width: 100%;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
    background: radial-gradient(circle at top left, hsl(var(--secondary)) 0%, hsl(var(--background)) 55%),
    radial-gradient(circle at 80% 20%, hsl(var(--accent)) 0%, transparent 55%);
    color: hsl(var(--foreground));
    min-height: 100vh;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 16rem;
    background: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

/* Header inside sidebar */
.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
}

.sidebar-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.nav-link.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid hsl(var(--border));
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* ============ HEADER ============ */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-header-main {
    min-width: 0;
    flex: 1;
}

.admin-header-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.admin-header .link-muted,
.admin-header .header-title {
    margin: 0;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ OVERLAY (MOBILE SIDEBAR) ============ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
    display: none; /* hidden by default */
}

/* shown when JS adds .show */
.sidebar-overlay.show {
    display: block;
}

/* ============ PAGE HELPERS ============ */
.page-card {
    margin-bottom: 1.5rem;
}

.app-shell,
.app-main,
.app-content,
.app-container {
    min-width: 0;
}

.app-content {
    width: 100%;
}

/* main layout spacing (desktop) */
.main-content {
    margin-left: 16rem;
    min-height: 100vh;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    /* shown when JS adds .open */
    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .admin-header {
        flex-wrap: nowrap;
        align-items: center;
        padding: 0.875rem 1rem;
    }

    .admin-header > * {
        min-width: 0;
    }

    .admin-header .link-muted {
        display: none;
    }

    .admin-header-actions {
        width: auto;
        justify-content: flex-end;
        flex: 0 0 auto;
    }

    .header-title {
        font-size: 1rem;
        line-height: 1.2;
    }
}
