/*
 * UndanganKu application shell modernization.
 * Presentation-only layer. No PWA/service-worker behavior.
 */
:root {
    --bdu-shell-primary: #E0040E;
    --bdu-shell-primary-hover: #C8010B;
    --bdu-shell-primary-dark: #A90006;
    --bdu-shell-primary-deep: #730007;
    --bdu-shell-primary-soft: #FFF1F2;
    --bdu-shell-secondary: #E6B755;
    --bdu-shell-secondary-soft: #FFF7E3;
    --bdu-shell-surface: #FFFDF9;
    --bdu-shell-ink: #2C1518;
    --bdu-shell-muted: #786A6C;
    --bdu-shell-border: rgba(115, 0, 7, .11);
    --bdu-shell-radius: 20px;
    --bdu-shell-safe-top: env(safe-area-inset-top, 0px);
    --bdu-shell-safe-right: env(safe-area-inset-right, 0px);
    --bdu-shell-safe-bottom: env(safe-area-inset-bottom, 0px);
    --bdu-shell-safe-left: env(safe-area-inset-left, 0px);
}

.bdu-app-page :where(a, button, select, input, textarea):focus-visible,
.bdu-platform-page :where(a, button, select, input, textarea):focus-visible,
.bdu-nav-sheet :where(a, button):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--bdu-shell-secondary) 72%, white);
    outline-offset: 3px;
}
.bdu-app-page :where(a, button),
.bdu-platform-page :where(a, button),
.bdu-nav-sheet :where(a, button) {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (min-width: 768px) {
    .bdu-app-page {
        background:
            radial-gradient(circle at 78% -8%, rgba(230, 183, 85, .10), transparent 30rem),
            linear-gradient(180deg, #fffdf9 0, #faf7f5 100%);
    }
    .bdu-app-page .bdu-sidebar {
        border-right: 1px solid rgba(230, 183, 85, .18);
        background: linear-gradient(180deg, rgba(115, 0, 7, .98), rgba(44, 21, 24, .99));
        box-shadow: 18px 0 50px rgba(44, 21, 24, .08);
    }
    .bdu-app-page .bdu-sidebar-workspace {
        border: 1px solid rgba(230, 183, 85, .22);
        border-radius: 18px;
        background: rgba(255, 253, 249, .07);
        padding: 14px;
    }
    .bdu-app-page .bdu-sidebar-select {
        min-height: 44px;
        border-color: rgba(255, 255, 255, .18);
        background: rgba(255, 255, 255, .96);
    }
    .bdu-app-page .bdu-sidebar-switch {
        min-height: 44px;
        border: 1px solid rgba(230, 183, 85, .42);
        border-radius: 12px;
        background: var(--bdu-shell-secondary);
        color: #3b2100;
        font-weight: 800;
    }
    .bdu-app-page .bdu-sidebar-nav {
        display: grid;
        gap: 5px;
    }
    .bdu-app-page .bdu-sidebar-nav > a {
        min-height: 44px;
        border: 1px solid transparent;
        border-radius: 13px;
        transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
    }
    .bdu-app-page .bdu-sidebar-nav > a:hover {
        border-color: rgba(230, 183, 85, .20);
        background: rgba(255, 255, 255, .07);
        transform: translateX(2px);
    }
    .bdu-app-page .bdu-sidebar-nav > a.is-active {
        border-color: rgba(230, 183, 85, .38);
        background: linear-gradient(135deg, rgba(224, 4, 14, .34), rgba(230, 183, 85, .12));
        box-shadow: inset 3px 0 0 var(--bdu-shell-secondary);
    }
    .bdu-app-page .bdu-content {
        width: min(100%, 1480px);
        margin-inline: auto;
        padding-left: clamp(24px, 3vw, 40px);
        padding-right: clamp(24px, 3vw, 40px);
    }
}

@media (max-width: 767px) {
    .bdu-app-page {
        background:
            radial-gradient(circle at 90% 0, rgba(230, 183, 85, .12), transparent 16rem),
            #f8f6f5;
    }
    .bdu-app-page .bdu-mobile-header {
        min-height: calc(62px + var(--bdu-shell-safe-top));
        border-bottom: 1px solid rgba(115, 0, 7, .08);
        background: rgba(255, 253, 249, .94);
        box-shadow: 0 10px 34px rgba(44, 21, 24, .06);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }
    .bdu-app-page .bdu-content {
        padding-left: max(16px, var(--bdu-shell-safe-left)) !important;
        padding-right: max(16px, var(--bdu-shell-safe-right)) !important;
        padding-bottom: calc(104px + var(--bdu-shell-safe-bottom)) !important;
    }
    .bdu-app-page .bdu-mobile-account[data-bdu-nav-secondary="1"] {
        display: none !important;
    }
    .bdu-app-page .bdu-mobile-nav.is-shell-enhanced {
        right: max(10px, var(--bdu-shell-safe-right));
        bottom: max(10px, var(--bdu-shell-safe-bottom));
        left: max(10px, var(--bdu-shell-safe-left));
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-auto-flow: row;
        grid-auto-columns: unset;
        min-height: 68px;
        border: 1px solid rgba(115, 0, 7, .10);
        border-radius: 22px;
        background: rgba(255, 253, 249, .97);
        box-shadow: 0 18px 48px rgba(44, 21, 24, .18);
        padding: 6px;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    .bdu-app-page .bdu-mobile-nav.is-shell-enhanced > :where(a, button) {
        appearance: none;
        display: grid !important;
        grid-template-rows: 24px auto;
        place-items: center;
        min-width: 0;
        min-height: 54px;
        border: 0;
        border-radius: 16px;
        background: transparent;
        padding: 6px 3px !important;
        color: #7c6d70 !important;
        font: inherit;
        font-size: 10.5px !important;
        font-weight: 800 !important;
        line-height: 1.1;
        text-align: center;
        text-decoration: none !important;
        cursor: pointer;
    }
    .bdu-app-page .bdu-mobile-nav.is-shell-enhanced > :where(a, button).is-active {
        background: linear-gradient(180deg, var(--bdu-shell-primary-soft), #fff7f4) !important;
        color: var(--bdu-shell-primary-dark) !important;
        box-shadow: inset 0 0 0 1px rgba(224, 4, 14, .08);
    }
    .bdu-app-page .bdu-mobile-nav.is-shell-enhanced .bdu-icon {
        width: 21px;
        height: 21px;
    }
}

@media (min-width: 981px) {
    .bdu-platform-page {
        background:
            radial-gradient(circle at 84% -10%, rgba(230, 183, 85, .10), transparent 30rem),
            #f8f5f4;
    }
    .bdu-platform-page .bdu-platform-sidebar {
        border-right: 1px solid rgba(230, 183, 85, .18);
        background: linear-gradient(180deg, #2c1518 0%, #180d0f 100%);
        box-shadow: 18px 0 50px rgba(24, 13, 15, .10);
    }
    .bdu-platform-page .bdu-platform-label {
        border-radius: 999px;
        background: rgba(230, 183, 85, .12);
        color: #f5d892;
        letter-spacing: .08em;
    }
    .bdu-platform-page .bdu-platform-nav {
        display: grid;
        gap: 5px;
    }
    .bdu-platform-page .bdu-platform-nav > a {
        min-height: 44px;
        border: 1px solid transparent;
        border-radius: 13px;
        transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
    }
    .bdu-platform-page .bdu-platform-nav > a:hover {
        border-color: rgba(230, 183, 85, .18);
        background: rgba(255, 255, 255, .06);
        transform: translateX(2px);
    }
    .bdu-platform-page .bdu-platform-nav > a.is-active {
        border-color: rgba(230, 183, 85, .30);
        background: linear-gradient(135deg, rgba(224, 4, 14, .25), rgba(230, 183, 85, .10));
        box-shadow: inset 3px 0 0 var(--bdu-shell-secondary);
    }
    .bdu-platform-page .bdu-platform-content {
        width: min(100%, 1540px);
        margin-inline: auto;
        padding-left: clamp(24px, 3vw, 42px);
        padding-right: clamp(24px, 3vw, 42px);
    }
}

.bdu-platform-mobile-nav { display: none; }
@media (max-width: 980px) {
    .bdu-platform-page.has-bdu-mobile-nav .bdu-platform-content {
        padding-bottom: calc(104px + var(--bdu-shell-safe-bottom));
    }
    .bdu-platform-page .bdu-platform-mobile-header {
        min-height: calc(62px + var(--bdu-shell-safe-top));
        padding-top: var(--bdu-shell-safe-top);
        padding-left: max(16px, var(--bdu-shell-safe-left));
        padding-right: max(16px, var(--bdu-shell-safe-right));
        border-bottom: 1px solid rgba(230, 183, 85, .18);
        background: rgba(44, 21, 24, .96);
        box-shadow: 0 12px 34px rgba(24, 13, 15, .18);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }
    .bdu-platform-mobile-nav {
        position: fixed;
        z-index: 90;
        right: max(10px, var(--bdu-shell-safe-right));
        bottom: max(10px, var(--bdu-shell-safe-bottom));
        left: max(10px, var(--bdu-shell-safe-left));
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
        min-height: 68px;
        border: 1px solid rgba(115, 0, 7, .11);
        border-radius: 22px;
        background: rgba(255, 253, 249, .98);
        box-shadow: 0 18px 48px rgba(44, 21, 24, .22);
        padding: 6px;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    .bdu-platform-mobile-nav > :where(a, button) {
        appearance: none;
        display: grid;
        grid-template-rows: 24px auto;
        place-items: center;
        min-width: 0;
        min-height: 54px;
        border: 0;
        border-radius: 16px;
        background: transparent;
        padding: 6px 3px;
        color: #756568;
        font: inherit;
        font-size: 10.5px;
        font-weight: 800;
        line-height: 1.1;
        text-align: center;
        text-decoration: none;
        cursor: pointer;
    }
    .bdu-platform-mobile-nav > :where(a, button).is-active {
        background: linear-gradient(180deg, var(--bdu-shell-primary-soft), #fff7f4);
        color: var(--bdu-shell-primary-dark);
        box-shadow: inset 0 0 0 1px rgba(224, 4, 14, .08);
    }
    .bdu-platform-mobile-nav .bdu-icon { width: 21px; height: 21px; }
}

.bdu-nav-sheet {
    width: min(620px, 100%);
    max-width: 100%;
    max-height: min(84dvh, 760px);
    margin: auto 0 0;
    border: 0;
    border-radius: 26px 26px 0 0;
    background: var(--bdu-shell-surface);
    color: var(--bdu-shell-ink);
    padding: 0;
    box-shadow: 0 -24px 70px rgba(44, 21, 24, .22);
}
.bdu-nav-sheet::backdrop {
    background: rgba(24, 13, 15, .52);
    backdrop-filter: blur(3px);
}
.bdu-nav-sheet-shell {
    display: grid;
    max-height: min(84dvh, 760px);
    grid-template-rows: auto minmax(0, 1fr);
}
.bdu-nav-sheet-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(115, 0, 7, .08);
    padding: 28px 20px 16px;
}
.bdu-nav-sheet-head::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: #ded5d3;
    transform: translateX(-50%);
}
.bdu-nav-sheet-head strong {
    display: block;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.2rem;
    line-height: 1.2;
}
.bdu-nav-sheet-head span {
    display: block;
    margin-top: 3px;
    color: var(--bdu-shell-muted);
    font-size: .78rem;
}
.bdu-nav-sheet-close {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(115, 0, 7, .10);
    border-radius: 14px;
    background: #fff;
    color: var(--bdu-shell-ink);
    cursor: pointer;
}
.bdu-nav-sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 16px calc(20px + var(--bdu-shell-safe-bottom));
}
.bdu-nav-sheet-section + .bdu-nav-sheet-section {
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid rgba(115, 0, 7, .08);
}
.bdu-nav-sheet-label {
    margin: 0 4px 8px;
    color: var(--bdu-shell-muted);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.bdu-nav-sheet-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.bdu-nav-sheet-list > a,
.bdu-nav-sheet-list > form > button {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: 58px;
    gap: 9px;
    border: 1px solid rgba(115, 0, 7, .09);
    border-radius: 16px;
    background: #fff;
    padding: 9px 11px;
    color: var(--bdu-shell-ink);
    font: inherit;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.bdu-nav-sheet-list > a.is-active {
    border-color: rgba(224, 4, 14, .22);
    background: var(--bdu-shell-primary-soft);
    color: var(--bdu-shell-primary-dark);
}
.bdu-nav-sheet-list .bdu-icon { width: 20px; height: 20px; }
.bdu-nav-sheet-list > form { margin: 0; min-width: 0; }
.bdu-nav-sheet-list > form > button { color: var(--bdu-shell-primary-dark); }

/* Mobile sign-out is intentionally a full-width session action, not another
 * navigation tile. Desktop keeps its existing sidebar owner; this treatment is
 * scoped to the mobile navigation sheet shared by Dashboard and Admin. */
.bdu-nav-sheet-list > form.bdu-mobile-logout-form {
    grid-column: 1 / -1;
    width: 100%;
}
.bdu-nav-sheet-list > form.bdu-mobile-logout-form > .bdu-mobile-logout-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    border-color: var(--bdu-shell-primary);
    background: linear-gradient(180deg, #E0040E, #C70009);
    color: #fff;
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .01em;
    text-align: center;
    box-shadow: 0 8px 18px rgba(169, 0, 6, .16);
}
.bdu-nav-sheet-list > form.bdu-mobile-logout-form > .bdu-mobile-logout-action:hover,
.bdu-nav-sheet-list > form.bdu-mobile-logout-form > .bdu-mobile-logout-action:focus-visible {
    border-color: var(--bdu-shell-primary-dark);
    background: var(--bdu-shell-primary-dark);
    color: #fff;
}
.bdu-mobile-logout-section {
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid rgba(115, 0, 7, .08);
}
.bdu-mobile-logout-list { grid-template-columns: minmax(0, 1fr); }
.bdu-nav-more .bdu-icon { pointer-events: none; }

@media (max-width: 420px) {
    .bdu-nav-sheet-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .bdu-app-page *,
    .bdu-platform-page *,
    .bdu-nav-sheet * {
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}
