/* ============================================
   Common Sidebar Styles with Responsive Design
   ============================================ */

/* Sidebar Container */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a7f5f 0%, #2d8659 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-active);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item span {
    white-space: nowrap;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar .theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-size: 14px;
}

.sidebar .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content Offset */
.main-content,
.main-container {
    margin-left: 260px;
    flex: 1;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Mobile Menu Toggle Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 150;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--primary-color);
    opacity: 0.9;
    transform: scale(1.05);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Close Button for Mobile Sidebar */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--sidebar-active);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: var(--danger-color);
    color: white;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Tablet - Medium Screens (768px - 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content,
    .main-container {
        margin-left: 220px;
    }

    .sidebar-header {
        padding: 1.25rem;
    }

    .sidebar-title {
        font-size: 16px;
    }
}

/* Mobile - Small Screens (below 768px) */
@media (max-width: 768px) {
    /* Show toggle button */
    .sidebar-toggle {
        display: flex;
    }

    /* Show overlay when sidebar is open */
    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.show {
        pointer-events: auto;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* Show sidebar when open */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    /* Show close button on mobile */
    .sidebar.open .sidebar-close {
        display: flex;
    }

    /* Reset main content margin on mobile */
    .main-content,
    .main-container {
        margin-left: 0;
    }

    /* Add padding for toggle button */
    .top-bar {
        padding-left: 4.5rem !important;
    }

    /* Adjust search box on mobile */
    .search-box {
        width: 100% !important;
        max-width: 300px;
    }
}

/* Extra Small Screens (below 480px) */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    .sidebar-toggle {
        top: 0.75rem;
        left: 0.75rem;
        width: 40px;
        height: 40px;
    }

    .top-bar {
        padding: 0.75rem !important;
        padding-left: 4rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .search-box {
        max-width: 100%;
        flex: 1;
        min-width: 150px;
    }

    .top-bar-actions {
        gap: 8px;
    }
}

/* Animation for sidebar */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* Body class when sidebar is open - prevent scroll */
body.sidebar-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    body.sidebar-open {
        overflow: auto;
    }
}
