/* Minimal Icon-Only Sidebar - Matching sidebar.png Design */

:root {
    --sidebar-width: 60px;
    --sidebar-mobile-width: 280px;
    --sidebar-bg: #8B2799;
    --sidebar-icon-color: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: rgba(255, 255, 255, 0.2);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #8B2799 0%, #6A1B7A 100%);
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Close Button (Hidden on Desktop) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 1002;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.sidebar-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* Sidebar Navigation */
.sidebar-nav {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: top;
    justify-content: flex-start;
    padding-top: 20px;
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

/* Menu Items */
.sidebar-menu-item {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    color: var(--sidebar-icon-color);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    gap: 15px;
}

.sidebar-link i {
    font-size: 20px;
    color: var(--sidebar-icon-color);
    transition: transform 0.3s ease;
}

/* Sidebar Text (Hidden on Desktop) */
.sidebar-text {
    display: none;
    font-size: 16px;
    font-weight: 500;
    color: white;
}

/* Hover Effect */
.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
}

.sidebar-link:hover i {
    transform: scale(1.1);
}

/* Active State */
.sidebar-menu-item.active .sidebar-link {
    background-color: var(--sidebar-active-bg);
}

.sidebar-menu-item.active .sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 40px;
    background-color: var(--sidebar-icon-color);
    border-radius: 0 4px 4px 0;
}

/* Main Content Wrapper */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* When navbar exists, don't add margin to body */
body {
    padding-left: var(--sidebar-width);
    transition: padding-left 0.3s ease;
}

/* Mobile Toggle Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #8F1EAE;
    color: #8F1EAE;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(143, 30, 174, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.sidebar-toggle i {
    font-size: 22px;
    color: #8F1EAE;
}

.sidebar-toggle:hover {
    background-color: #8F1EAE;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(143, 30, 174, 0.4);
}

.sidebar-toggle:hover i {
    color: white;
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Animation for toggle button icon */
.sidebar.active ~ .sidebar-toggle i {
    transform: rotate(90deg);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: auto;
        right: 0;
        width: var(--sidebar-mobile-width);
        transform: translateX(100%);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        background: linear-gradient(180deg, #8B2799 0%, #6A1B7A 50%, #4A0E54 100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Show Close Button on Mobile */
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Show Text Labels on Mobile */
    .sidebar-text {
        display: block;
    }

    /* Adjust Link Layout for Mobile */
    .sidebar-link {
        justify-content: flex-start;
        padding: 0 25px;
        height: 65px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-link i {
        font-size: 22px;
    }

    /* Active State Indicator on Mobile - Left Side */
    .sidebar-menu-item.active .sidebar-link::before {
        right: 0;
        left: auto;
        border-radius: 4px 0 0 4px;
        width: 5px;
        height: 100%;
        top: 0;
        transform: none;
    }

    /* Add Top Spacing for Mobile Menu */
    .sidebar-nav {
        padding-top: 80px;
    }

    /* Remove Tooltip on Mobile */
    .sidebar-link::after {
        display: none;
    }

    /* Hover Effects for Mobile */
    .sidebar-link:hover {
        background-color: rgba(255, 255, 255, 0.15);
        padding-left: 30px;
    }

    /* Active State Background */
    .sidebar-menu-item.active .sidebar-link {
        background: linear-gradient(90deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content,
    body {
        margin-left: 0;
        padding-left: 0;
    }
}

/* Tablet Responsive - Keep Desktop Sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 55px;
    }

    .sidebar-link {
        height: 55px;
    }

    .sidebar-link i {
        font-size: 18px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Tooltip (shows title on hover for better UX - Desktop Only) */
.sidebar-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-size: 13px;
    z-index: 1002;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar-link:hover::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar-link::after {
        display: none !important;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay,
    .sidebar-close {
        display: none;
    }

    .main-content,
    body {
        margin-left: 0;
        padding-left: 0;
    }
}

/* Smooth Animation for Sidebar Items */
@media (max-width: 768px) {
    .sidebar-menu-item {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.3s ease;
    }

    .sidebar.active .sidebar-menu-item {
        opacity: 1;
        transform: translateX(0);
    }

    .sidebar.active .sidebar-menu-item:nth-child(1) { transition-delay: 0.05s; }
    .sidebar.active .sidebar-menu-item:nth-child(2) { transition-delay: 0.1s; }
    .sidebar.active .sidebar-menu-item:nth-child(3) { transition-delay: 0.15s; }
    .sidebar.active .sidebar-menu-item:nth-child(4) { transition-delay: 0.2s; }
    .sidebar.active .sidebar-menu-item:nth-child(5) { transition-delay: 0.25s; }
    .sidebar.active .sidebar-menu-item:nth-child(6) { transition-delay: 0.3s; }
    .sidebar.active .sidebar-menu-item:nth-child(7) { transition-delay: 0.35s; }
}
