/**
 * eap-portal-shell-recovery.css
 * Emergency shared-shell recovery layer.
 * Scope: portal shell only (body.eap-portal-template + .eap-viewport-shell)
 */

:root {
    --eap-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --eap-bg: #eef3f8;
    --eap-surface: #ffffff;
    --eap-surface-2: #f8fbff;
    --eap-surface-3: #f1f5f9;
    --eap-text-primary: #0f172a;
    --eap-text-secondary: #475569;
    --eap-text-muted: #64748b;
    --eap-text-inverse: #f8fafc;
    --eap-border: #dbe5f0;
    --eap-border-hover: #bfd6f9;
    --eap-blue: #2563eb;
    --eap-blue-dark: #1d4ed8;
    --eap-sidebar-bg: linear-gradient(180deg, #1859d1 0%, #0f4cb8 48%, #0c3e96 100%);
    --eap-sidebar-width: 272px;
    --eap-sidebar-width-collapsed: 78px;
    --eap-adminbar-h: 0px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-full: 999px;
    --gap-sm: 10px;
    --gap-md: 16px;
    --gap-lg: 22px;
    --ease: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
}

body.eap-portal-template {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--eap-bg) !important;
    color: var(--eap-text-primary) !important;
}

body.eap-portal-template #wpcontent,
body.eap-portal-template #wpbody-content {
    margin: 0 !important;
    padding: 0 !important;
}

body.eap-portal-template .eap-viewport-shell,
body.eap-portal-template .eap-viewport-shell * {
    box-sizing: border-box;
}

body.eap-portal-template .eap-viewport-shell {
    position: fixed !important;
    top: var(--eap-adminbar-h, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: calc(100vh - var(--eap-adminbar-h, 0px)) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transform: none !important;
    zoom: 1 !important;
    isolation: isolate;
    z-index: 9990;
    font-family: var(--eap-font) !important;
    background: var(--eap-bg) !important;
    color: var(--eap-text-primary) !important;
}

body.eap-portal-template .eap-shell-inner,
body.eap-portal-template .eap-dashboard-app-wrap {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
}

body.eap-portal-template .eap-sidebar {
    width: var(--eap-sidebar-width) !important;
    min-width: var(--eap-sidebar-width) !important;
    max-width: var(--eap-sidebar-width) !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 24px 18px !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: var(--gap-lg) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: var(--eap-sidebar-bg) !important;
    color: var(--eap-text-inverse) !important;
    box-shadow: 18px 0 40px rgba(11, 53, 127, 0.18) !important;
    transform: none !important;
}

body.eap-portal-template .eap-sidebar-top {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--gap-lg) !important;
}

body.eap-portal-template .eap-main {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    background: var(--eap-bg) !important;
    color: var(--eap-text-primary) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    transform: none !important;
}

body.eap-portal-template .eap-topbar,
body.eap-portal-template .eap-content {
    width: 100% !important;
}

body.eap-portal-template .eap-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    padding: 28px 32px 0 !important;
}

body.eap-portal-template .eap-content {
    padding: 28px 32px 40px !important;
}

/* Sidebar/menu readability */
body.eap-portal-template .eap-nav-link,
body.eap-portal-template .eap-sidebar-logout,
body.eap-portal-template .eap-sidebar-user-role,
body.eap-portal-template .eap-logo-sub {
    color: rgba(255, 255, 255, 0.78) !important;
}

body.eap-portal-template .eap-logo-name,
body.eap-portal-template .eap-sidebar-user-name,
body.eap-portal-template .eap-nav-link:hover,
body.eap-portal-template .eap-nav-link:focus-visible,
body.eap-portal-template .eap-nav-link.active,
body.eap-portal-template .eap-sidebar-logout:hover {
    color: #ffffff !important;
}

body.eap-portal-template .eap-nav-link:hover,
body.eap-portal-template .eap-nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.14) !important;
}

body.eap-portal-template .eap-nav-link.active {
    background: rgba(255, 255, 255, 0.22) !important;
    border-left: 3px solid #ffffff !important;
}

/* Shared shell contrast defaults (not module redesign) */
body.eap-portal-template .eap-page-title,
body.eap-portal-template .eap-card-title,
body.eap-portal-template h1,
body.eap-portal-template h2,
body.eap-portal-template h3,
body.eap-portal-template label,
body.eap-portal-template th,
body.eap-portal-template td {
    color: var(--eap-text-primary) !important;
}

body.eap-portal-template .eap-page-subtitle,
body.eap-portal-template .eap-form-note,
body.eap-portal-template .eap-form-help,
body.eap-portal-template .description,
body.eap-portal-template .eap-muted,
body.eap-portal-template small {
    color: var(--eap-text-secondary) !important;
}

body.eap-portal-template .eap-card,
body.eap-portal-template .eap-widget,
body.eap-portal-template .eap-kpi-card {
    background: var(--eap-surface) !important;
}

body.eap-portal-template .eap-card:not(.eap-card--blue):not(.eap-card--amber):not(.eap-card--coral):not(.eap-card--mint) *,
body.eap-portal-template .eap-widget:not(.eap-card--blue):not(.eap-card--amber):not(.eap-card--coral):not(.eap-card--mint) * {
    color: var(--eap-text-primary) !important;
}

/* Keep theme/page leakage from altering portal shell */
body.eap-portal-template .site,
body.eap-portal-template #page,
body.eap-portal-template .ast-container,
body.eap-portal-template .entry-content {
    max-width: none !important;
}

@media (max-width: 1024px) {
    body.eap-portal-template .eap-dashboard-app-wrap,
    body.eap-portal-template .eap-shell-inner {
        flex-direction: column !important;
    }

    body.eap-portal-template .eap-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        padding: 14px 20px !important;
    }
}
