﻿/* ═══════════════════════════════════════════
       Dashboard Navbar — Global CSS
       Add to wwwroot/css/dashboard-nav.css
       Link in App.razor: <link rel="stylesheet" href="css/dashboard-nav.css" />
    ═══════════════════════════════════════════ */

/* ── Layout ── */
.dl-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.dl-sidebar {
    width: 230px;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
    border-right: 1px solid rgba(0,0,0,0.07);
    transition: width 0.25s ease;
    z-index: 20;
}

    .dl-sidebar.dl-sidebar-sm {
        width: 62px;
    }

.dl-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    background: #faf9f7;
}

.dl-mob-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
}

.dl-mob-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
}

    .dl-mob-toggle:hover {
        background: #f1f3f5;
    }

.dl-mob-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.3px;
}

.dl-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 15;
}

/* ── Sidebar wrap ── */
.dn-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    font-family: 'DM Sans', sans-serif;
}

/* ── Logo row ── */
.dn-logo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
    min-height: 56px;
    gap: 8px;
}

.dn-logo-link {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.4px;
    overflow: hidden;
    flex: 1;
    transition: opacity 0.2s;
}

.dn-accent {
    color: #5daad3;
}

.dn-toggle {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s;
}

    .dn-toggle:hover {
        background: #f1f3f5;
    }

.dn-chevron {
    transition: transform 0.25s ease;
    display: block;
}

/* ── Nav ── */
.dn-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: none;
}

    .dn-nav::-webkit-scrollbar {
        display: none;
    }

.dn-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dn-lbl {
    font-size: 10px;
    font-weight: 600;
    color: #9aacb8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 10px;
    margin-bottom: 4px;
    display: block;
    white-space: nowrap;
    transition: opacity 0.15s, height 0.25s;
    overflow: hidden;
}

/* ── Nav item ── */
.dn-item {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important; /* ✅ force horizontal */
    gap: 0px;
    padding: 9px 10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}

    .dn-item:hover {
        background: #f1f3f5;
        color: #1a1a2e;
    }

    .dn-item.active {
        background: #ebf5ff !important;
        color: #5daad3 !important;
        font-weight: 500;
    }

        .dn-item.active .dn-icon {
            stroke: #5daad3;
        }

        .dn-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 7px;
            bottom: 7px;
            width: 3px;
            background: #5daad3;
            border-radius: 0 3px 3px 0;
        }

/* ── Icon — always 18x18 ── */
.dn-icon {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    flex-shrink: 0 !important;
    display: block !important;
    stroke: currentColor;
    fill: none;
    margin: 0 auto;
}

/* ── Text ── */
.dn-txt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s, max-width 0.25s;
    max-width: 160px;
    display: block;
}

/* ── Tooltip ── */
.dn-tip {
    display: none;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a2e;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999;
}

    .dn-tip::before {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #1a1a2e;
    }

/* ── Bottom ── */
.dn-bottom {
    flex-shrink: 0;
    padding: 8px 8px 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dn-user {
    display: flex;
    align-items: center;
/*    justify-content: center;*/
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #faf9f7;
    margin-bottom: 4px;
    overflow: hidden;
    position: relative;
    transition: padding 0.25s;
}

.dn-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50%;
    background: #5daad3;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden; /* ✅ text never bleeds out */
    text-overflow: clip;
    white-space: nowrap;
}

.dn-uinfo {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.15s, max-width 0.25s;
    max-width: 130px;
}

.dn-uname {
    font-size: 12px;
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dn-urole {
    font-size: 10px;
    color: #9aacb8;
    margin-top: 1px;
}

.dn-logout {
    color: #4a5568 !important;
}

    .dn-logout:hover {
        background: #f8d7da !important;
        color: #842029 !important;
    }

        .dn-logout:hover .dn-icon {
            stroke: #842029 !important;
        }

/* ══════════════════════════════
       COLLAPSED
    ══════════════════════════════ */
.dl-sidebar.dl-sidebar-sm .dn-logo-link {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.dl-sidebar.dl-sidebar-sm .dn-chevron {
    transform: rotate(180deg);
}

.dl-sidebar.dl-sidebar-sm .dn-lbl {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.dl-sidebar.dl-sidebar-sm .dn-txt {
    opacity: 0;
    max-width: 0;
}

.dl-sidebar.dl-sidebar-sm .dn-uinfo {
    opacity: 0;
    max-width: 0;
}

.dl-sidebar.dl-sidebar-sm .dn-item {
    justify-content: center;
    padding: 10px;
}

    .dl-sidebar.dl-sidebar-sm .dn-item.active::before {
        display: none;
    }

.dl-sidebar.dl-sidebar-sm .dn-user {
    padding-left:15px !important;
    justify-content: center;
    padding: 8px;
}

.dl-sidebar.dl-sidebar-sm .dn-item:hover .dn-tip {
    display: block;
}

.dl-sidebar.dl-sidebar-sm .dn-user:hover .dn-tip {
    display: block;
}

/* ══════════════════════════════
       RESPONSIVE
    ══════════════════════════════ */
@media (max-width: 1024px) {
    .dl-sidebar {
        width: 62px;
    }

        .dl-sidebar .dn-logo-link {
            opacity: 0;
            max-width: 0;
        }

        .dl-sidebar .dn-lbl {
            opacity: 0;
            height: 0;
            margin: 0;
            padding: 0;
        }

        .dl-sidebar .dn-txt {
            opacity: 0;
            max-width: 0;
        }

        .dl-sidebar .dn-uinfo {
            opacity: 0;
            max-width: 0;
        }

        .dl-sidebar .dn-item {
            justify-content: center;
            padding: 10px;
        }

        .dl-sidebar .dn-user {
            justify-content: center;
        }
}

@media (max-width: 768px) {
    .dl-layout {
        flex-direction: column;
    }

    .dl-mob-bar {
        display: flex;
    }

    .dl-sidebar {
        position: absolute;
        top: 0;
        left: -240px;
        height: 100%;
        width: 230px !important;
        transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    }

        .dl-sidebar.dl-mob-open {
            left: 0;
        }

        .dl-sidebar .dn-logo-link {
            opacity: 1 !important;
            max-width: 160px !important;
        }

        .dl-sidebar .dn-lbl {
            opacity: 1 !important;
            height: auto !important;
        }

        .dl-sidebar .dn-txt {
            opacity: 1 !important;
            max-width: 160px !important;
        }

        .dl-sidebar .dn-uinfo {
            opacity: 1 !important;
            max-width: 130px !important;
        }

        .dl-sidebar .dn-item {
            justify-content: flex-start !important;
            padding: 9px 10px !important;
        }

        .dl-sidebar .dn-user {
            justify-content: flex-start !important;
        }
}

/* ── JS-toggled overlay ── */
.dl-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 15;
}

    .dl-overlay.dl-overlay-show {
        display: block;
    }

/* ── Chevron rotation when collapsed ── */
.dl-sidebar.dl-sidebar-sm .dn-chevron {
    transform: rotate(180deg);
}
