/* Mobile Navigation System - Collapsible Icon Sidebar */

/* ================================
   Collapsible Sidebar
   ================================ */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 56px;
    background: #fdfdfd;
    border-right: 1px solid #ededed;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s ease;
    box-shadow: 2px 0 12px rgba(17, 24, 39, 0.05);
}

/* Hidden state - slides off screen */
.mobile-sidebar.hidden {
    transform: translateX(-60px);
}

/* Expanded state */
.mobile-sidebar.expanded {
    width: 210px;
}

.mobile-sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f3f4f6;
    padding: 0 12px;
}

.mobile-sidebar-logo {
    width: 34px;
    height: 34px;
    background: #111111;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.mobile-sidebar.expanded .mobile-sidebar-header {
    justify-content: flex-start;
    gap: 12px;
}

.mobile-sidebar-brand-text {
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
    display: none;
    white-space: nowrap;
}

.mobile-sidebar.expanded .mobile-sidebar-brand-text {
    display: block;
}

/* Sidebar Navigation */
.mobile-sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.mobile-sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 4px 8px;
    border-radius: 10px;
    color: #111111;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    gap: 6px;
}

.sidebar-nav-item:hover {
    background: #f4f4f5;
    color: #111111;
    text-decoration: none;
}

.sidebar-nav-item.active {
    background: #ededed;
    color: #111111;
}

.sidebar-nav-item i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    color: #111111;
}

.sidebar-nav-item span {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: none;
    color: #111111;
}

.mobile-sidebar.expanded .sidebar-nav-item span {
    display: block;
}

/* Tooltip for collapsed state */
.sidebar-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 60px;
    padding: 6px 12px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1100;
    pointer-events: none;
}

.mobile-sidebar:not(.expanded) .sidebar-nav-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Section divider */
.sidebar-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 8px 12px;
}

/* Badge on nav items */
.sidebar-nav-item .nav-badge {
    position: absolute;
    top: 8px;
    left: 28px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.mobile-sidebar.expanded .sidebar-nav-item .nav-badge {
    position: static;
    margin-left: auto;
}

/* Sidebar Footer */
.mobile-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #f3f4f6;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6cf7 0%, #3b50d9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin: 0 auto;
}

.mobile-sidebar.expanded .sidebar-user-avatar {
    margin: 0;
}

.sidebar-user-info {
    display: none;
    margin-left: 12px;
}

.mobile-sidebar.expanded .mobile-sidebar-footer {
    display: flex;
    align-items: center;
}

.mobile-sidebar.expanded .sidebar-user-info {
    display: block;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.sidebar-user-role {
    font-size: 12px;
    color: #6b7280;
}

/* ================================
   Toggle Button (Floating)
   ================================ */
.sidebar-toggle {
    position: fixed;
    top: 50%;
    left: 60px;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1051;
    transition: left 0.3s ease, transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle i {
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.mobile-sidebar.hidden~.sidebar-toggle {
    left: 0;
    border-radius: 0 8px 8px 0;
}

.mobile-sidebar.hidden~.sidebar-toggle i {
    transform: rotate(180deg);
}

.mobile-sidebar.expanded~.sidebar-toggle {
    left: 220px;
}

/* Hide toggle when sidebar expanded */
.mobile-sidebar.expanded~.sidebar-toggle i {
    transform: rotate(180deg);
}

/* ================================
   Main Content Adjustment
   ================================ */
.main-content {
    transition: margin-left 0.3s ease, padding-left 0.3s ease;
}

body.sidebar-visible .main-content {
    margin-left: 60px;
}

body.sidebar-visible .app-header {
    left: 60px;
}

body.sidebar-expanded .main-content {
    margin-left: 220px;
}

body.sidebar-expanded .app-header {
    left: 220px;
}

body.sidebar-hidden .main-content {
    margin-left: 0;
}

body.sidebar-hidden .app-header {
    left: 0;
}

/* ================================
   Hide Bottom Nav (use sidebar instead)
   ================================ */
.bottom-nav {
    display: none !important;
}

/* ================================
   Mobile Specific Styles
   ================================ */
@media (max-width: 767.98px) {
    .mobile-sidebar {
        width: 56px;
    }

    .mobile-sidebar.expanded {
        width: 240px;
    }

    .mobile-sidebar.hidden {
        transform: translateX(-56px);
    }

    .sidebar-toggle {
        left: 56px;
    }

    .mobile-sidebar.hidden~.sidebar-toggle {
        left: 0;
    }

    .mobile-sidebar.expanded~.sidebar-toggle {
        left: 240px;
    }

    body.sidebar-visible .main-content {
        margin-left: 56px;
    }

    body.sidebar-visible .app-header {
        left: 56px;
    }

    body.sidebar-expanded .main-content {
        margin-left: 0;
        /* On mobile, overlay instead of push */
    }

    body.sidebar-expanded .app-header {
        left: 0;
    }

    /* Overlay for expanded sidebar on mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        z-index: 1040;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* When sidebar hidden, give full width */
    body.sidebar-hidden .main-content {
        width: 100%;
        padding-left: 20px;
    }

    /* Smaller nav items on mobile */
    .sidebar-nav-item {
        padding: 10px;
        margin: 2px 6px;
    }

    .sidebar-nav-item i {
        font-size: 16px;
    }
}

/* ================================
   Tablet and Desktop
   ================================ */
@media (min-width: 768px) {
    .mobile-sidebar {
        width: 64px;
    }

    .mobile-sidebar.expanded {
        width: 240px;
    }

    body.sidebar-visible .main-content {
        margin-left: 64px;
    }

    body.sidebar-visible .app-header {
        left: 64px;
    }

    body.sidebar-expanded .main-content {
        margin-left: 240px;
    }

    body.sidebar-expanded .app-header {
        left: 240px;
    }

    .sidebar-toggle {
        left: 64px;
    }

    .mobile-sidebar.expanded~.sidebar-toggle {
        left: 240px;
    }
}

/* ================================
   Hide elements on larger screens
   if using traditional layout
   ================================ */
@media (min-width: 1200px) {

    /* Keep sidebar visible on large screens */
    .mobile-sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    body.sidebar-visible .main-content,
    body.sidebar-expanded .main-content {
        margin-left: 64px;
    }

    body.sidebar-visible .app-header,
    body.sidebar-expanded .app-header {
        left: 64px;
    }

    .mobile-sidebar:hover {
        width: 240px;
    }

    .mobile-sidebar:hover .sidebar-nav-item span {
        display: block;
    }

    .mobile-sidebar:hover .mobile-sidebar-brand-text {
        display: block;
    }

    .mobile-sidebar:hover .sidebar-user-info {
        display: block;
    }

    .mobile-sidebar:hover~.main-content {
        margin-left: 240px;
    }
}

/* ================================
   Touch Optimizations
   ================================ */
@media (hover: none) and (pointer: coarse) {
    .sidebar-nav-item {
        padding: 14px 12px;
    }

    .sidebar-nav-item:active {
        background: #e5e7eb;
        transform: scale(0.98);
    }

    .sidebar-toggle {
        width: 28px;
        height: 56px;
    }

    .sidebar-toggle:active {
        background: #f3f4f6;
    }
}

/* ================================
   Accessibility
   ================================ */
.sidebar-nav-item:focus {
    outline: 2px solid #4a6cf7;
    outline-offset: 2px;
}

.sidebar-toggle:focus {
    outline: 2px solid #4a6cf7;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================
   Color-coded Nav Items
   ================================ */
.sidebar-nav-item[data-section="main"] i {
    color: #4a6cf7;
}

.sidebar-nav-item[data-section="work"] i {
    color: #10b981;
}

.sidebar-nav-item[data-section="hr"] i {
    color: #f59e0b;
}

.sidebar-nav-item[data-section="admin"] i {
    color: #ef4444;
}

.sidebar-nav-item.active i,
.sidebar-nav-item:hover i {
    color: #4a6cf7;
}

/* Color dots for sections */
.section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 8px auto;
}

.section-dot.main {
    background: #4a6cf7;
}

.section-dot.work {
    background: #10b981;
}

.section-dot.hr {
    background: #f59e0b;
}

.section-dot.admin {
    background: #ef4444;
}