/* ========================================
   SIDEBAR STYLES
   ======================================== */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(180deg, #3d5750 0%, #2d4238 100%);
    z-index: 1030;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

/* ========================================
   SIDEBAR BRAND
   ======================================== */
.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-brand .brand-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    display: block;
    transition: all 0.3s ease;
}

.sidebar-brand .brand-link:hover {
    opacity: 0.85;
}

/* ========================================
   USER PROFILE SECTION
   ======================================== */
.sidebar-user {
    padding: 1.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.user-avatar {
    color: #68d391;
    margin-bottom: 0.75rem;
}

.user-avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 3px solid rgba(104, 211, 145, 0.5);
    box-shadow: 0 0 0 4px rgba(104, 211, 145, 0.12), 0 2px 8px rgba(0, 0, 0, 0.3);
    background-color: rgba(61, 87, 80, 0.6);
}

.user-info {
    color: #fff;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.user-credits {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(104, 211, 145, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

.credits-amount {
    font-weight: 700;
    color: #68d391;
}

/* ========================================
   NAVIGATION MENU
   ======================================== */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08) !important;
    border-left-color: #68d391;
    padding-left: 1.5rem;
}

.nav-link.active {
    color: #fff;
    background: rgba(104, 211, 145, 0.15);
    border-left-color: #68d391;
}

.nav-label {
    flex: 1;
    font-size: 0.95rem;
}

/* ========================================
   SUBMENU STYLES
   ======================================== */
.submenu-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
}

.submenu-item {
    margin: 0;
}

.submenu-link {
    display: block;
    padding: 0.75rem 1.25rem 0.75rem 3rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.submenu-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(104, 211, 145, 0.5);
    padding-left: 3.25rem;
}

/* ========================================
   SIDEBAR FOOTER
   ======================================== */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.footer-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.footer-text a {
    color: #68d391;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-text a:hover {
    color: #7ee3a5;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   MODERN MOBILE NAVBAR STYLES
   ======================================== */
.modern-navbar {
    background: linear-gradient(135deg, #3d5750 0%, #2d4238 100%) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Modern Hamburger Toggle */
.modern-toggler {
    border: none;
    padding: 0.5rem;
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
    padding-top:5px;
}

.modern-toggler:focus {
    box-shadow: 0 0 0 3px rgba(104, 211, 145, 0.3);
    outline: none;
}

.modern-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar-toggler-icon-custom {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 14px;
    position: relative;
    margin: auto;
}

.navbar-toggler-icon-custom span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* When menu is OPEN (toggler is NOT collapsed) */
.modern-toggler:not(.collapsed) .navbar-toggler-icon-custom {
    justify-content: center;
}

.modern-toggler:not(.collapsed) .navbar-toggler-icon-custom span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.modern-toggler:not(.collapsed) .navbar-toggler-icon-custom span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.modern-toggler:not(.collapsed) .navbar-toggler-icon-custom span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Modern Mobile Menu */
.modern-nav {
    padding-top: 1rem;
}

.modern-nav .nav-item {
    margin-bottom: 0.25rem;
}

.modern-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.875rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.modern-nav .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #68d391;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.nav-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding-left: 1.25rem;
}

.modern-nav .nav-link:hover,
.modern-nav .nav-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding-left: 1.25rem;
}

.modern-nav .nav-link:hover::before {
    transform: scaleY(1);
}

.modern-nav .nav-link.active {
    background: rgba(104, 211, 145, 0.15);
    color: #fff;
}

.modern-nav .nav-link.active::before {
    transform: scaleY(1);
}

/* Dropdown Menu Styling for Mobile */
.modern-nav .dropdown-menu {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 0.5rem;
    backdrop-filter: blur(10px);
}

.modern-nav .dropdown-item {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.modern-nav .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding-left: 2rem;
}

/* Collapsible Menu Animation */
.navbar-collapse {
    background: linear-gradient(180deg, rgba(61, 87, 80, 0.98) 0%, rgba(45, 66, 56, 0.98) 100%);
    margin: 1rem -1rem -0.75rem;
    padding: 1rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom:20px;
}

/* User Credits Badge in Mobile */
.modern-nav .btn-light {
    background: rgba(104, 211, 145, 0.2);
    border: 1px solid rgba(104, 211, 145, 0.4);
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modern-nav .btn-light:hover {
    background: rgba(104, 211, 145, 0.3);
    border-color: #68d391;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(104, 211, 145, 0.3);
}

/* ========================================
   MAIN CONTENT ADJUSTMENT
   ======================================== */
@media (min-width: 991.98px) {
    #main {
        margin-left: 280px;
        transition: margin-left 0.3s ease;
    }

    footer {
        margin-left: 280px;
        transition: margin-left 0.3s ease;
    }
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 991.98px) {
    #sidebar {
        display: none !important;
    }

    #main {
        margin-left: 0;
    }

    footer {
        margin-left: 0;
    }

}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

#sidebar {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-collapse.show,
.navbar-collapse.collapsing {
    animation: fadeInDown 0.3s ease-out;
}