/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Sidebar Layout */
body {
    overflow-x: hidden;
    background-color: #f3f4f6;
    font-family: 'Poppins', sans-serif !important;
}

/* Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar Styles */
#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: #1e293b;
    /* Slate 800 */
    color: #cbd5e1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    margin-left: -260px;
}

/* Sidebar Header / Brand */
.sidebar-header {
    padding: 20px;
    background: #0f172a;
    /* Slate 900 */
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70px;
}

/* Brand overrides for sidebar context */
.sidebar-header .brand-container {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    transform: none !important;
}

.sidebar-header .brand-text {
    font-size: 1.5rem !important;
    color: #fff;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    /* Blue glow */
}

.sidebar-header .brand-plus {
    color: #fbbf24;
    /* Amber 400 */
}

.sidebar-header .brand-pro {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0f172a;
    /* Slate 900 for better contrast on gold */
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.85rem !important;
    font-weight: 700;
    margin-left: 6px;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
}

/* Sidebar Menu */
.sidebar-user-card h6 {
    color: #f8fafc;
    font-weight: 600;
}

#sidebar ul.components {
    padding: 10px 0;
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 0;
}

#sidebar ul li {
    padding: 2px 10px;
}

#sidebar ul li a {
    padding: 12px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    color: #94a3b8;
    /* Slate 400 */
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border-radius: 8px;
    font-weight: 500;
}

#sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

/* Active State & Icons */
#sidebar ul li a i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
    color: #64748b;
    /* Slate 500 */
    transition: color 0.3s;
}

#sidebar ul li a:hover i {
    color: #3b82f6;
    /* Blue 500 */
}

/* Dropdown / Collapse */
#sidebar ul li a.dropdown-toggle {
    position: relative;
    justify-content: space-between;
}

/* Remove default bootstrap arrow and add custom if needed, or rely on chevron icon */
#sidebar ul li a.dropdown-toggle::after {
    margin-left: auto;
    transition: transform 0.3s;
}

#sidebar ul li a[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

#sidebar ul li a[aria-expanded="true"] {
    color: #fff;
    background: #1e293b;
}

#sidebar ul.collapse {
    background: transparent;
    border-left: 2px solid #334155;
    margin-left: 20px;
    padding-left: 5px;
}

#sidebar ul.collapse li a {
    padding: 8px 10px;
    font-size: 0.85rem;
    color: #94a3b8;
}

#sidebar ul.collapse li a:hover {
    color: #fff;
    background: transparent;
    transform: translateX(4px);
}

#sidebar ul.collapse li a i {
    font-size: 0.8rem;
    margin-right: 10px;
}

/* Content Area */
#content {
    width: 100%;
    margin-left: 260px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#content.active {
    margin-left: 0;
}

/* Top Navbar */
.navbar-top {
    background: #fff;
    padding: 12px 24px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    z-index: 1020;
}

@media (max-width: 576px) {
    .navbar-top {
        padding: 8px 12px;
    }
}

.btn-toggle-sidebar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

@media (max-width: 576px) {
    .btn-toggle-sidebar {
        width: 32px;
        height: 32px;
    }
}

.btn-toggle-sidebar:hover {
    background: #fff;
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.1);
}

/* Scrollbar styling */
#sidebar ul.components::-webkit-scrollbar {
    width: 4px;
}

#sidebar ul.components::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar ul.components::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 20px;
}

#sidebar ul.components::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Helper Classes */
.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 991px) {
    #sidebar {
        margin-left: -260px;
    }

    #sidebar.active {
        margin-left: 0;
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.5);
    }

    #content {
        margin-left: 0;
    }

    #content.active {
        margin-left: 0;
        /* Don't push content on mobile, overlay instead */
    }

    /* Overlay when sidebar open on mobile */
    #sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 260px;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }
}