/* ============================================================
   GILGAMEZ PLATFORM v3.0.0 — ADMIN CORE SHELL & GRID (Rule #18)
   Standardized 3-Part Shell & 5-Tier Viewport System (Rule #6)
   ============================================================ */

/* ─── 1. Wrapperless Admin Shell CSS Grid ──────────────────────── */
html {
    height: 100%;
    height: 100dvh;
    overflow: hidden !important;
    margin: 0;
    padding: 0;
    touch-action: pan-y;
}

body.admin-body {
    margin: 0;
    padding: 0;
    overflow: hidden !important;
    background-color: var(--bg-base, #0a0c10);
    height: 100%;
    height: 100dvh;
    width: 100vw;
    position: fixed;
    inset: 0;
    touch-action: pan-y;
}

@media (min-width: 992px) {
    body.admin-body {
        display: grid;
        grid-template-columns: 256px 1fr;
        grid-template-rows: 60px 1fr;
        grid-template-areas:
            "sidebar header"
            "sidebar main";
        transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.admin-body.sidebar-collapsed {
        grid-template-columns: 72px 1fr;
    }
}

@media (max-width: 991px) {
    body.admin-body,
    body.admin-body.sidebar-collapsed {
        display: grid;
        grid-template-columns: 100% !important;
        grid-template-rows: 60px 1fr !important;
        grid-template-areas:
            "header"
            "main" !important;
        width: 100vw;
        height: 100%;
        height: 100dvh;
        position: fixed;
        inset: 0;
        overflow: hidden !important;
    }

    #admin-header,
    .admin-header {
        grid-area: header;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
        flex-shrink: 0;
    }

    #admin-main,
    .admin-main {
        grid-area: main;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    body.admin-body,
    body.admin-body.sidebar-collapsed {
        grid-template-rows: 56px 1fr !important;
    }
}

@media (max-width: 480px) {
    body.admin-body,
    body.admin-body.sidebar-collapsed {
        grid-template-rows: 54px 1fr !important;
    }
}

/* ─── 2. Shell Grid Area Assignments ──────────────────────────── */
#admin-header, 
.admin-header {
    grid-area: header;
}

#admin-sidebar, 
.admin-sidebar {
    grid-area: sidebar;
}

#admin-main, 
.admin-main {
    grid-area: main;
}

/* ─── 3. Root Application View Container ───────────────────────── */
#app, 
.admin-view-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    #app, 
    .admin-view-container {
        padding: 0;
    }
}

@media (max-width: 480px) {
    #app, 
    .admin-view-container {
        padding: 0;
    }
}

/* ─── 4. Topbar Platform Environment Indicator ─────────────────── */
.topbar-env-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.topbar-env-pill.pill-prod {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.topbar-env-pill.pill-prod:hover {
    background: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.topbar-env-pill.pill-dev {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.topbar-env-pill.pill-dev:hover {
    background: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.topbar-env-dot {
    font-size: 0.85rem;
}
