/* ===================================
   SIDEBAR STYLES - Navbar Extension
   Seamless integration with navbar
   =================================== */

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(244, 119, 33, 0.1);
    box-shadow: 2px 0 20px rgba(244, 119, 33, 0.05);
    padding: 0;
    width: 240px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(244, 119, 33, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(244, 119, 33, 0.3);
}

/* Sidebar Header — same height as navbar, acts as left half of the header strip */
.sidebar-header {
    height: 60px;
    min-height: 60px;
    padding: 0 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(244, 119, 33, 0.1);
    flex-shrink: 0;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f47721 0%, #ff9147 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(244, 119, 33, 0.25);
    transition: all 0.2s ease;
}

.brand-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(244, 119, 33, 0.35);
}

.brand-text {
    flex: 1;
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f47721;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.6rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 2px;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(244, 119, 33, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(244, 119, 33, 0.15);
    transform: translateY(-1px);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    fill: #f47721;
    transition: transform 0.3s ease;
}

.sidebar.minimized .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Navigation Sections */
.nav-section {
    padding: 0.35rem 0;
}

.nav-title {
    font-weight: 600;
    font-size: 0.65rem;
    color: #999;
    padding: 0.6rem 0.85rem 0.4rem 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-title i {
    color: #f47721;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Navigation Lists */
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.15rem;
}

/* Navigation Links */
.sidebar a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.85rem;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    background: rgba(244, 119, 33, 0.05);
    color: #f47721;
    border-left-color: rgba(244, 119, 33, 0.3);
}

/* Active Link */
.sidebar a.active {
    background: rgba(244, 119, 33, 0.08);
    color: #f47721;
    font-weight: 600;
    border-left-color: #f47721;
}

/* Navigation Icons */
.nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(244, 119, 33, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-icon i {
    font-size: 0.85rem;
    color: #f47721;
    transition: all 0.2s ease;
}

.sidebar a:hover .nav-icon {
    background: rgba(244, 119, 33, 0.12);
}

.sidebar a.active .nav-icon {
    background: linear-gradient(135deg, #f47721 0%, #ff9147 100%);
    box-shadow: 0 2px 8px rgba(244, 119, 33, 0.3);
}

.sidebar a.active .nav-icon i {
    color: white;
}

/* Link Text */
.link-text {
    flex: 1;
    font-size: 0.85rem;
}

/* Link Badges (for notifications) */
.link-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #f47721;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    display: none;
}

.link-badge:not(:empty) {
    display: block;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 0.85rem;
    border-top: 1px solid rgba(244, 119, 33, 0.08);
    text-align: center;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(244, 119, 33, 0.02) 50%, rgba(255, 255, 255, 0.1) 100%);
}

.sidebar-footer .text-muted {
    color: #999 !important;
    font-size: 0.65rem;
}

/* Dark Mode Support */
body.dark-mode .sidebar {
    background: linear-gradient(180deg, rgba(30, 30, 30, 0.98) 0%, rgba(25, 25, 25, 0.95) 100%);
    border-right-color: rgba(244, 119, 33, 0.15);
    box-shadow: 2px 0 20px rgba(244, 119, 33, 0.08);
}

body.dark-mode .sidebar-header {
    border-bottom-color: rgba(244, 119, 33, 0.1);
    background: linear-gradient(90deg, rgba(30, 30, 30, 0.1) 0%, rgba(244, 119, 33, 0.03) 50%, rgba(30, 30, 30, 0.1) 100%);
}

body.dark-mode .brand-title {
    color: #ff9147;
}

body.dark-mode .brand-subtitle {
    color: #666;
}

body.dark-mode .nav-title {
    color: #999;
}

body.dark-mode .sidebar a {
    color: #ccc;
    border-left-color: transparent;
}

body.dark-mode .sidebar a:hover {
    background: rgba(244, 119, 33, 0.1);
    color: #ff9147;
    border-left-color: rgba(244, 119, 33, 0.5);
}

body.dark-mode .sidebar a.active {
    background: rgba(244, 119, 33, 0.12);
    color: #ff9147;
    border-left-color: #f47721;
}

body.dark-mode .nav-icon {
    background: rgba(244, 119, 33, 0.12);
}

body.dark-mode .sidebar a:hover .nav-icon {
    background: rgba(244, 119, 33, 0.15);
}

body.dark-mode .sidebar-footer {
    border-top-color: rgba(244, 119, 33, 0.1);
    background: linear-gradient(90deg, rgba(30, 30, 30, 0.1) 0%, rgba(244, 119, 33, 0.03) 50%, rgba(30, 30, 30, 0.1) 100%);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: rgba(244, 119, 33, 0.3);
}

/* Sidebar close button (mobile drawer only) */
.sidebar-mobile-close {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(244, 119, 33, 0.08);
    color: #f47721;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-mobile-close:hover {
    background: rgba(244, 119, 33, 0.15);
}

/* Backdrop shown behind the mobile sidebar drawer */
.sidebar-backdrop {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        top: 0;
        width: 240px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.has-sidebar.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-close {
        display: flex;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .brand-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .sidebar a {
        padding: 0.45rem 0.65rem;
        font-size: 0.8rem;
    }

    .nav-icon {
        width: 26px;
        height: 26px;
    }

    .nav-icon i {
        font-size: 0.8rem;
    }

    .nav-title {
        font-size: 0.6rem;
        padding: 0.55rem 0.65rem 0.35rem 0.65rem;
    }
}

/* Collapsed Sidebar State */
.sidebar.minimized {
    width: 60px;
}

.sidebar.minimized .brand-text,
.sidebar.minimized .link-text,
.sidebar.minimized .brand-subtitle,
.sidebar.minimized .sidebar-footer,
.sidebar.minimized .link-badge {
    display: none;
}

.sidebar.minimized .brand-section {
    justify-content: center;
}

.sidebar.minimized .sidebar-header {
    padding: 0 0.5rem;
    justify-content: center;
}

.sidebar.minimized .nav-title {
    justify-content: center;
    padding: 0.6rem 0.5rem 0.4rem 0.5rem;
}

.sidebar.minimized .nav-title i {
    margin: 0;
}

.sidebar.minimized .nav-title span {
    display: none;
}

.sidebar.minimized a {
    justify-content: center;
    padding: 0.5rem 0.5rem;
    border-left: none;
    border-right: 3px solid transparent;
}

.sidebar.minimized a:hover {
    border-right-color: rgba(244, 119, 33, 0.3);
}

.sidebar.minimized a.active {
    border-right-color: #f47721;
}

.sidebar.minimized .nav-icon {
    margin: 0;
    width: 32px;
    height: 32px;
}

.sidebar.minimized .nav-icon i {
    font-size: 0.9rem;
}

/* Container padding adjustment */
.container-wrapper {
    padding-top: 60px;
    padding-left: 240px;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-minimized .container-wrapper {
    padding-left: 60px;
}

@media (max-width: 768px) {
    .container-wrapper {
        padding-left: 0;
        padding-top: 60px;
    }
}

/* Animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar {
    animation: slideInLeft 0.3s ease-out;
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
