/* =========================================================
   PORTAL SHELL / SIDEBAR ROADMAP
   Used by: Components/Layout/MainLayout.razor
            Components/Layout/NavMenu.razor

   Keep shell/sidebar/timeline navigation styling here. This file
   is loaded after CSS isolation in Components/App.razor, so it is
   the safest place for global sidebar overrides that must beat
   default anchor/link styling.
   ========================================================= */
/* Sidebar sizing, colour tokens and shared layout variables. */
:root {
    --dp-sidebar-width: 282px;
    --dp-sidebar-bg-1: #071426;
    --dp-sidebar-bg-2: #0d1b2f;
    --dp-sidebar-border: rgba(148, 163, 184, 0.18);
    --dp-sidebar-text: #dbe7f5;
    --dp-sidebar-muted: #8fa3bb;
    --dp-sidebar-hover: rgba(59, 130, 246, 0.18);
    --dp-sidebar-active: linear-gradient(90deg, rgba(37, 99, 235, 0.56), rgba(37, 99, 235, 0.22));
}

/* App shell: fixed desktop layout and the main scroll container. */
html,
body { height: 100%; }

.dp-app-shell {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background: #eef3f9;
}

.dp-main-shell {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dp-main-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

/* Sidebar container and global link reset. */
nav.dp-sidebar-shell,
nav.dp-sidebar-shell * { box-sizing: border-box; }

nav.dp-sidebar-shell {
    width: var(--dp-sidebar-width);
    min-width: var(--dp-sidebar-width);
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--dp-sidebar-bg-1), var(--dp-sidebar-bg-2));
    color: var(--dp-sidebar-text);
    border-right: 1px solid var(--dp-sidebar-border);
    box-shadow: 14px 0 32px rgba(2, 6, 23, 0.26);
    z-index: 50;
}

nav.dp-sidebar-shell a,
nav.dp-sidebar-shell a:link,
nav.dp-sidebar-shell a:visited,
nav.dp-sidebar-shell a:hover,
nav.dp-sidebar-shell a:focus,
nav.dp-sidebar-shell a:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* Sidebar brand/header block. */
.dp-sidebar-brand-row {
    flex: 0 0 auto;
    padding: 0 2px 12px;
    border-bottom: 1px solid var(--dp-sidebar-border);
}

.dp-sidebar-brand {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: #fff !important;
}

.dp-sidebar-logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 950;
    letter-spacing: -0.05em;
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.32);
}

.dp-sidebar-brand-copy { min-width: 0; display: grid; gap: 2px; }
.dp-sidebar-brand-copy strong { color: #fff; font-size: 0.95rem; line-height: 1.05; }
.dp-sidebar-brand-copy small { color: #9fb1c8; font-size: 0.69rem; line-height: 1.1; }

/* Scrollable navigation area. */
.dp-sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.dp-sidebar-scroll::-webkit-scrollbar { width: 8px; }
.dp-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.45); border-radius: 999px; }

/* Collapsible navigation groups. */
.dp-sidebar-section { margin: 3px 0 8px; }

.dp-sidebar-section summary {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 13px;
    color: #d7e2f0;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
}

.dp-sidebar-section summary::-webkit-details-marker { display: none; }
.dp-sidebar-section summary:hover { background: rgba(255,255,255,0.06); color: #fff; }
.dp-sidebar-section summary::after {
    content: "⌄";
    margin-left: auto;
    color: var(--dp-sidebar-muted);
    font-size: 0.86rem;
    transition: transform 0.15s ease;
}
.dp-sidebar-section:not([open]) summary::after { transform: rotate(-90deg); }

.dp-sidebar-subnav {
    display: grid;
    gap: 3px;
    padding: 3px 0 7px;
}


/* Standard sidebar links. */


/* Navigation icon and platform badge variants. */
.dp-sidebar-icon,
.dp-platform-badge {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #dbeafe;
    background: rgba(148, 163, 184, 0.14);
    font-size: 0.62rem;
    font-family: Arial, sans-serif;
    font-weight: 950;
    line-height: 1;
    letter-spacing: -0.02em;
}

.dp-sidebar-section-title,
.dp-sidebar-brand-copy strong,
.dp-sidebar-brand-copy small,
.dp-account-copy strong,
.dp-account-copy small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-platform-amazon { background: rgba(249, 115, 22, 0.20); color: #fed7aa; }
.dp-platform-uber { background: rgba(16, 185, 129, 0.20); color: #bbf7d0; }
.dp-icon-blue { background: rgba(37, 99, 235, 0.22); color: #93c5fd; }


.dp-icon-purple { background: rgba(147, 51, 234, 0.20); color: #d8b4fe; }
.dp-icon-indigo { background: rgba(99, 102, 241, 0.20); color: #c4b5fd; }

.dp-icon-red { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.dp-icon-slate { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

/* Fixed account/action area at the bottom of the sidebar. */
.dp-sidebar-fixed-bottom {
    position: relative;
    flex: 0 0 auto;
    display: grid;
    gap: 9px;
    padding-top: 12px;
    border-top: 1px solid var(--dp-sidebar-border);
}

.dp-account-menu { position: relative; }

.dp-account-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    cursor: pointer;
    list-style: none;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.20);
}
.dp-account-summary::-webkit-details-marker { display: none; }
.dp-account-summary:hover { border-color: rgba(96,165,250,0.45); background: rgba(37,99,235,0.14); }

.dp-account-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 0.78rem;
    font-family: Arial, sans-serif;
    font-weight: 950;
}
.dp-account-avatar::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    border: 2px solid #0d1b2f;
}
.dp-account-copy { display: grid; gap: 2px; min-width: 0; }
.dp-account-copy strong { color: #fff; font-size: 0.82rem; line-height: 1.1; }
.dp-account-copy small { color: #9fb1c8; font-size: 0.65rem; line-height: 1.1; }
.dp-account-caret { color: #9fb1c8; font-weight: 900; }
.dp-account-menu[open] .dp-account-caret { transform: rotate(180deg); }

.dp-account-popover {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    display: grid;
    gap: 5px;
    padding: 10px;
    border-radius: 18px;
    background: #111d2d;
    border: 1px solid rgba(148, 163, 184, 0.26);
    box-shadow: 0 20px 48px rgba(2, 6, 23, 0.44);
    z-index: 60;
}
.dp-account-popover-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 9px;
    align-items: center;
    padding: 4px 4px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.dp-account-popover-header strong { display: block; color: #fff; font-size: 0.86rem; }
.dp-account-popover-header small { display: block; color: #9fb1c8; font-size: 0.66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dp-account-link,
.dp-account-link:link,
.dp-account-link:visited,
.dp-account-link:hover,
.dp-account-link:focus,
.dp-account-link:active,
.dp-sidebar-logout-form button.dp-account-link {
    width: 100%;
    display: grid !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border-radius: 13px;
    border: 0;
    background: transparent;
    color: var(--dp-sidebar-text) !important;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
    font: inherit;
}
.dp-account-link:hover,
.dp-sidebar-logout-form button.dp-account-link:hover { background: rgba(255,255,255,0.07); color: #fff !important; }
.dp-account-link strong { display: block; font-size: 0.80rem; color: inherit; line-height: 1.1; }
.dp-account-link small { display: block; margin-top: 2px; color: #8fa3bb; font-size: 0.65rem; line-height: 1.15; }
.dp-sidebar-logout-form { margin: 0; padding-top: 4px; border-top: 1px solid rgba(148, 163, 184, 0.18); }
.dp-account-link-danger,
.dp-account-link-danger:visited { color: #fecaca !important; }

.dp-sidebar-footer-copy {
    color: #718198;
    font-size: 0.67rem;
    font-weight: 760;
    text-align: center;
}

.dp-sidebar-auth-actions { display: grid; gap: 8px; margin-top: auto; }

@media (max-width: 900px) {
    .dp-app-shell { position: static; min-height: 100vh; display: block; overflow: auto; }
    nav.dp-sidebar-shell { width: 100%; min-width: 0; height: auto; max-height: none; }
    .dp-main-shell,
.dp-main-content { overflow: visible; }
}

/* Timeline sidebar override - child items must not render as pills */
nav.dp-sidebar-shell .dp-sidebar-section[open] > summary {
    color: #fff !important;
    background: linear-gradient(90deg, rgba(37, 99, 235, .72), rgba(30, 64, 175, .48)) !important;
    box-shadow: inset 3px 0 0 #60a5fa, 0 10px 24px rgba(15, 23, 42, .18) !important;
}

nav.dp-sidebar-shell .dp-sidebar-subnav {
    position: relative !important;
    display: grid !important;
    gap: 0 !important;
    margin: 5px 0 9px 0 !important;
    padding: 4px 0 4px 28px !important;
}

nav.dp-sidebar-shell .dp-sidebar-subnav::before {
    content: "" !important;
    position: absolute !important;
    left: 14px !important;
    top: 9px !important;
    bottom: 9px !important;
    width: 1px !important;
    background: rgba(148, 163, 184, .36) !important;
    border-radius: 999px !important;
}


/* Real timeline sidebar links. These are markup-based, not CSS guesses against old NavLink/icon markup. */
/* Timeline subsection styling for inline child links in NavMenu. */
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline {
    position: relative !important;
    display: grid !important;
    gap: 2px !important;
    margin: 6px 0 10px 0 !important;
    padding: 4px 0 4px 24px !important;
}

nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline::before {
    content: "" !important;
    position: absolute !important;
    left: 9px !important;
    top: 12px !important;
    bottom: 12px !important;
    width: 1px !important;
    background: rgba(148, 163, 184, .36) !important;
    border-radius: 999px !important;
}

nav.dp-sidebar-shell .dp-timeline-link,
nav.dp-sidebar-shell .dp-timeline-link:link,
nav.dp-sidebar-shell .dp-timeline-link:visited,
nav.dp-sidebar-shell .dp-timeline-link:hover,
nav.dp-sidebar-shell .dp-timeline-link:focus,
nav.dp-sidebar-shell .dp-timeline-link:active {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    min-height: 31px !important;
    gap: 8px !important;
    padding: 3px 8px 3px 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(226, 232, 240, .82) !important;
    font-size: .82rem !important;
    font-weight: 720 !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
}

nav.dp-sidebar-shell .dp-timeline-link:hover,
nav.dp-sidebar-shell .dp-timeline-link:focus {
    color: #fff !important;
    background: rgba(255, 255, 255, .06) !important;
    outline: none !important;
}

nav.dp-sidebar-shell .dp-timeline-link.active,
nav.dp-sidebar-shell .dp-timeline-link.active:link,
nav.dp-sidebar-shell .dp-timeline-link.active:visited,
nav.dp-sidebar-shell .dp-timeline-link.active:hover,
nav.dp-sidebar-shell .dp-timeline-link.active:focus,
nav.dp-sidebar-shell .dp-timeline-link.active:active {
    color: #fff !important;
    background: transparent !important;
    box-shadow: none !important;
    font-weight: 850 !important;
}

nav.dp-sidebar-shell .dp-timeline-marker {
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    z-index: 2 !important;
    width: 10px !important;
    height: 18px !important;
    transform: translateY(-50%) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: rgba(148, 163, 184, .88) !important;
    font-size: 1rem !important;
    font-weight: 950 !important;
    line-height: 1 !important;
    background: linear-gradient(180deg, var(--dp-sidebar-bg-1), var(--dp-sidebar-bg-2)) !important;
}

nav.dp-sidebar-shell .dp-timeline-link.active .dp-timeline-marker {
    color: #3b82f6 !important;
    font-size: .86rem !important;
}

nav.dp-sidebar-shell .dp-timeline-text {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}


/* FINAL inline-markup timeline cleanup: prevent inherited old nav styles from affecting child timeline anchors. */
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:link,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:visited,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:hover,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:focus,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:active {
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:hover,
nav.dp-sidebar-shell .dp-sidebar-subnav.dp-sidebar-timeline .dp-timeline-link:focus {
    background: rgba(255,255,255,.06) !important;
}

/* Final scroll ownership: body stays locked; .dp-main-content scrolls. */
html,
body {
    height: 100%;
    overflow: hidden !important;
}

.dp-app-shell {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
}

.dp-main-shell {
    overflow: hidden !important;
}

.dp-main-content {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
}
