@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1:wght@100..900&family=Michroma&family=Space+Grotesk:wght@300..700&display=swap');

/* Root Variables */
:root {
    --primary-color: #ffffff;
    --primary-gold: #FFD700;
    --text-color: #ffffff;
    --heading-font: 'Michroma', sans-serif;
    --body-font: 'M PLUS 1', sans-serif;
    --vh: 1vh; /* Default value, updated by JS for iOS */
    
    /* Theme variables */
    --bg-gradient-dark: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), 
                       radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898;
    --bg-gradient-light: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%);
    --text-color-dark: #ffffff;
    --text-color-light: #333333;
    --sidebar-bg-dark: rgba(0, 0, 0, 0.3);
    --sidebar-bg-light: rgba(226, 209, 195, 0.9);
    --sidebar-icon-bg-dark: rgba(0, 0, 0, 0.2);
    --sidebar-icon-bg-light: rgba(255, 255, 255, 0.5);
    --nav-shadow-dark: 0 0 2px rgba(0, 0, 0, 0.8), 0 0 4px rgba(1, 1, 0, 0.4);
    --nav-shadow-light: none;
    --accent-color-dark: rgba(255, 215, 0, 0.6);
    --accent-color-light: rgba(255, 215, 0, 0.8);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Document-level theme to ensure consistency across page loads */
html.light-theme {
    color-scheme: light;
}

html.dark-theme {
    color-scheme: dark;
}

body {
    font-family: var(--body-font);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    color: var(--text-color-dark);
    padding-top: env(safe-area-inset-top);
    background: var(--bg-gradient-dark);
    background-blend-mode: multiply,multiply;
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    min-height: -webkit-fill-available;
    transition: background 0.5s ease, color 0.5s ease;
    display: flex;
    flex-direction: column;
}

/* Apply the theme at both document and body level for robustness */
html.light-theme body,
body.light-theme {
    color: var(--text-color-light);
    background: var(--bg-gradient-light);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 70px;
    height: 100vh;
    background-color: var(--sidebar-bg-dark);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0 0 0; /* Remove bottom padding */
    transition: width 0.3s ease, background-color 0.5s ease;
    overflow-x: hidden;
    overflow-y: auto; /* Allow vertical scrolling */
    position: fixed; /* Ensures it sticks when scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sidebar::-webkit-scrollbar {
    display: none;
}

html.light-theme .sidebar,
.light-theme .sidebar {
    background-color: var(--sidebar-bg-light);
}

/* For screens between 621px and 1299px, update sidebar layout */
@media (min-width: 621px) and (max-width: 1299px) {
    .sidebar {
        width: 80px; /* Wider to accommodate text beneath icons */
    }
    
    .user-controls {
        width: 80px;
    }
}

.sidebar-logo {
    margin-bottom: 0.5rem;
    margin-left: 0.2rem;
    display: flex;
    justify-content: center;
}

.sidebar-logo-img {
    object-fit: contain;
    transition: all 0.3s ease;
    width: 90%;
    height: 90%;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding-bottom: 110px; /* Space for fixed user controls */
    min-height: 0; /* Allow natural height */
    flex: 1; /* Take available space */
}

/* Reduce vertical spacing for medium screens */
@media (min-width: 621px) and (max-width: 1299px) {
    .sidebar-links {
        gap: 0.7rem; /* Reduced by 30% from 1rem */
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

/* Text placement under icons for medium screens */
@media (min-width: 621px) and (max-width: 1299px) {
    .sidebar-link {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding: 0.5rem 0.5rem; /* Reduced vertical padding by ~30% */
        height: auto;
    }
    
    /* Adjust glowing effect for medium screens */
    .sidebar-link.active .sidebar-icon {
        margin-bottom: 0.3rem;
        background: rgba(255, 215, 0, 0.2);
        border: 1px solid var(--primary-color);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    }
    
    .sidebar-link.active .sidebar-text {
        color: var(--primary-color);
    }

    .light-theme .sidebar-link.active .sidebar-text {
        color: black;    
    }
}

html.light-theme .sidebar-link,
.light-theme .sidebar-link {
    color: var(--text-color-light);
}

.sidebar-link.active {
    background: rgba(255, 215, 0, 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

html.light-theme .sidebar-link.active,
.light-theme .sidebar-link.active {
    background: rgba(255, 215, 0, 0.2);
    color: var(--text-color-light);
}

html.light-theme .sidebar-link.active .sidebar-icon,
.light-theme .sidebar-link.active .sidebar-icon {
    background: rgba(255, 215, 0, 0.3);
    border: 1px solid var(--primary-gold);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.sidebar-link.active .sidebar-icon {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.light-theme .sidebar-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-icon {
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--sidebar-icon-bg-dark);
    margin-right: 1rem;
    transition: background-color 0.5s ease;
}

/* Adjust icon spacing for medium screens */
@media (min-width: 621px) and (max-width: 1299px) {
    .sidebar-icon {
        margin-right: 0;
        margin-bottom: 0.3rem;
    }
}

html.light-theme .sidebar-icon,
.light-theme .sidebar-icon {
    background: var(--sidebar-icon-bg-light);
}

.sidebar-icon img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
    transition: all 0.3s ease;
}

html.light-theme .sidebar-icon img,
.light-theme .sidebar-icon img {
    filter: brightness(0.3);
}

/* Make sure icon is more vibrant when active */
.sidebar-link.active .sidebar-icon img {
    filter: brightness(0) invert(1);
    transform: scale(1.1);
}

html.light-theme .sidebar-link.active .sidebar-icon img,
.light-theme .sidebar-link.active .sidebar-icon img {
    filter: brightness(0) saturate(100%) invert(59%) sepia(87%) saturate(1094%) hue-rotate(4deg) brightness(99%) contrast(101%);
    transform: scale(1.1);
}

.sidebar-text {
    font-family: var(--heading-font);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    font-weight: 200;
}

.light-theme .sidebar-link.active .sidebar-text {
    color: black;    
}

/* Text size adjustments for different screens */
@media (min-width: 621px) and (max-width: 1299px) {
    .sidebar-text {
        font-size: 0.6rem;
        letter-spacing: 0;
    }

    .light-theme .sidebar-link.active .sidebar-text {
        color: black;    
    }
}

@media (max-width: 620px) {
    .sidebar-text {
        font-size: 1.2rem; /* Larger size for mobile */
    }

    .light-theme .sidebar-link.active .sidebar-text {
        color: black;    
    }
}

/* Navigation Styles */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    font-family: var(--heading-font);
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    height: 70px;
    padding: 0;
}

.nav-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 0;
    width: 100%;
    height: 100%;
    margin: 0 auto;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-right: 1rem;
}

.nav-links a {
    color: var(--text-color-dark);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
    text-shadow: var(--nav-shadow-dark);
}

.light-theme .nav-links a {
    color: var(--text-color-light);
    text-shadow: var(--nav-shadow-light);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Login/Logout Button Styles */
.login-button, .logout-link {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.5rem 1rem !important;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 1rem;
    display: inline-block;
}

.logout-link:hover, .login-button:hover {
    background: var(--primary-color);
    color: #6225E6 !important;
    text-shadow: none !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
}

/* Main Content Layout */
.main-content {
    margin-left: 70px;
    padding-top: 20px;
    min-height: 100vh;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    background: transparent;
}

/* Mobile Menu Styles */
.mobile-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    background: none;
    border: none;
    z-index: 1001;
}

/* Responsive Styles */
@media screen and (max-width: 620px) {
    /* These styles are overridden by the more specific rules at the end of the file */
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0.8rem 0;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .login-button {
        padding: 0.4rem 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .nav-links a {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    
    .logout-link, .login-button {
        padding: 0.3rem 0.7rem !important;
        font-size: 0.9rem;
    }
    
    .nav-container {
        padding: 0.6rem 0;
    }
}


/* Side menu for mobile */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Start off-screen */
    width: 300px;
    height: 100vh;
    background: rgba(98, 37, 230, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1001;
    padding: 80px 2rem 2rem;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

.side-menu.active {
    right: 0;
}

.side-menu .nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
}

.side-menu .nav-links a {
    font-size: 1.2rem;
    padding: 0.8rem 0;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    font-family: var(--nav-font);
    letter-spacing: 0.02em;
    display: block;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8),
                 0 0 4px rgba(1, 1, 0, 0.4);
}

.side-menu .nav-links a:hover {
    color: var(--primary-color);
}

.side-menu .logout-link {
    margin-top: 1rem;
    width: 100%;
    text-align: center;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.5rem 1rem !important;
}

.side-menu .logout-link:hover {
    background: var(--primary-color);
    color: #6225E6 !important;
    text-shadow: none !important;
}

.close-menu:hover {
    color: var(--primary-color);
}

/* Overlay when menu is open */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}


@media (min-width: 1300px) {
    .sidebar {
        display: block !important;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 210px !important; /* Force expanded width */
        overflow-y: auto; /* Allow vertical scrolling */
    }
    
    /* For large screens, restore horizontal sidebar links */
    .sidebar-link {
        flex-direction: row;
    }
    
    /* Add glowing effect for large screens */
    .sidebar-link.active .sidebar-icon {
        background: rgba(255, 215, 0, 0.2);
        border: 1px solid var(--primary-color);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    }
    
    .sidebar-link.active .sidebar-text {
        color: var(--primary-color);
    }

    .light-theme .sidebar-link.active .sidebar-text {
        color: black;    
    }
    
    .sidebar-icon {
        margin-right: 1rem;
        margin-bottom: 0;
    }
    
    /* Adjust dropdown position for expanded sidebar */
    .settings-dropdown {
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* For large screens, show user controls horizontally with settings left, profile right */
    .user-controls {
        flex-direction: row;
        justify-content: center; /* Center items in the sidebar */
        gap: 0.3rem; /* Minimal spacing as requested */
        padding: 0.8rem 0; /* Remove horizontal padding */
        width: 210px !important; /* Match large screen sidebar width */
        position: fixed; /* Keep fixed positioning */
        bottom: 0; /* Stick to bottom without gap */
        box-shadow: 0 -10px 20px var(--sidebar-bg-dark); /* Shadow for large screens too */
    }
    
    .light-theme .user-controls {
        box-shadow: 0 -10px 20px var(--sidebar-bg-light); /* Shadow for light theme large screens */
    }
    
    /* These ensure the sidebar doesn't scroll past the controls */
    .sidebar-links {
        padding-bottom: 75px; /* Space for controls */
        flex-grow: 1;
    }
    
    .profile-circle {
        order: 1;
    }
    
    .settings-container {
        order: 2;
    }

    .sidebar-link {
        width: 100% !important;
        padding: 1rem 2rem !important;
    }

    .sidebar-text {
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        transform: translateX(0) !important;
        transition: none !important;
        font-size: 0.8rem;
    }

    .sidebar-logo-img {
        object-fit: contain;
        transition: all 0.3s ease;
        width: 40%;
        height: 40%;
        margin-bottom: 1rem;
    }
    
    /* Adjust main content to account for expanded sidebar */
    .main-content {
        margin-left: 250px !important;
        width: calc(100% - 250px) !important;
    }
}

/* Theme Toggle Styles */
.theme-toggle-container {
    position: absolute;
    bottom: 20px;
    width: 100%;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
}

.light-theme .theme-toggle {
    color: var(--text-color-light);
}

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

.light-theme .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.theme-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sidebar-icon-bg-dark);
    font-size: 1.5rem;
}

.light-theme .theme-icon {
    background: var(--sidebar-icon-bg-light);
}

.light-icon {
    display: none;
}

.dark-icon {
    display: flex;
}

.light-theme .light-icon {
    display: flex;
}

.light-theme .dark-icon {
    display: none;
}

/* Mobile theme toggle */
.mobile-theme-toggle {
    width: 100%;
    margin: 1rem 0;
    display: flex;
    justify-content: flex-start;
}

.theme-toggle-mobile {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.3s ease;
    width: 100%;
}

/* User Profile Controls in Sidebar */
.user-controls {
    position: fixed;
    bottom: 0;
    width: 70px; /* Match sidebar width */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0;
    flex-direction: column;
    gap: 10px;
    background-color: var(--sidebar-bg-dark); /* Match sidebar background */
    transition: width 0.3s ease, background-color 0.5s ease; /* Match sidebar transitions */
    z-index: 1000; /* Higher z-index to overlay the scrollable sidebar */
    box-shadow: 0 -10px 20px var(--sidebar-bg-dark); /* Shadow effect to blend with sidebar */
}

html.light-theme .user-controls,
.light-theme .user-controls {
    background-color: var(--sidebar-bg-light);
    box-shadow: 0 -10px 20px var(--sidebar-bg-light); /* Shadow effect for light theme */
}

/* Ensure dropdown is properly positioned and sized for medium screens */
@media (min-width: 621px) and (max-width: 1299px) {
    .settings-dropdown {
        left: 40px; /* Center relative to settings toggle */
        transform: translateX(-50%);
        bottom: 50px;
        z-index: 1000; /* Make sure it's above other elements */
        width: 70px; /* Narrow dropdown for medium screens */
        padding: 0.4rem;
    }
    
    /* Fix settings container to make sure it's visible */
    .settings-container {
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    /* Make settings toggle more visible */
    .settings-toggle {
        margin: 0 auto;
        display: flex;
    }
    
    /* Hide text, show only icons in dropdown for medium screens */
    .dropdown-text {
        display: none; /* Hide text */
    }
    
    .dropdown-button {
        justify-content: center; /* Center the emoji */
        font-size: 1.2rem; /* Make emoji larger */
        padding: 0.6rem 0; /* Adjust padding */
    }
    
    .theme-icon {
        margin-right: 0; /* Remove margin since text is hidden */
    }
    
    /* Center the logout icon */
    .dropdown-icon {
        margin: 0 auto;
        font-size: 1.2rem;
    }
}

/* Ensure scrolling works properly for the sidebar content */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    flex-shrink: 0;
}

.sidebar-links {
    flex-grow: 1;
    padding-bottom: 85px; /* Provide enough space for user controls */
}

@media (min-width: 1300px) {
    .sidebar-links {
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

/* Hide scrollbar for screens smaller than 1300px */
@media (max-width: 1299px) {
    .sidebar-links {
        overflow-y: hidden;
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    .sidebar-links::-webkit-scrollbar {
        display: none;
    }
    
    .sidebar:hover .sidebar-links {
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

/* For small to medium screens, stack profile & settings vertically */
@media (min-width: 621px) and (max-width: 1299px) {
    .user-controls {
        flex-direction: column;
        gap: 10px;
        width: 80px; /* Match the sidebar width for medium screens */
        background-color: var(--sidebar-bg-dark); /* Ensure background is visible */
        z-index: 999; /* Higher z-index to be visible */
        bottom: 0; /* Stick to bottom */
        padding: 0.8rem 0; /* Consistent padding */
    }
    
    /* Profile circle first (at the top) when sidebar is not expanded */
    .profile-circle {
        order: 1;
        display: flex; /* Ensure it's visible */
    }
    
    .settings-container {
        order: 2;
        display: flex; /* Ensure it's visible */
    }
}

.profile-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-icon-bg-dark);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.light-theme .profile-circle {
    background: var(--sidebar-icon-bg-light);
    border-color: rgba(0, 0, 0, 0.1);
}

.profile-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
}

.profile-circle:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.profile-circle.active {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.1);
}

.light-theme .profile-circle.active {
    border: 2px solid var(--primary-gold);
    box-shadow: 0 0 8px rgba(255, 165, 0, 0.5);
    background: rgba(255, 165, 0, 0.15);
}

/* Settings dropdown */
.settings-container {
    position: relative;
}

.settings-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-icon-bg-dark);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.light-theme .settings-toggle {
    background: var(--sidebar-icon-bg-light);
}

.settings-toggle:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.2);
}

.light-theme .settings-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

.settings-dropdown {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    max-width: calc(100vw - 20px); /* Prevent overflow on very small screens */
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1010; /* Very high z-index to ensure it's above all other elements */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    visibility: visible; /* Ensure it's visible when active */
}

/* Ensure dropdown is always visible and properly positioned */
.settings-dropdown.active {
    display: flex !important;
}

.light-theme .settings-dropdown {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.settings-dropdown.active {
    display: flex;
}

.dropdown-item {
    width: 100%;
}

.dropdown-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    border: none;
    background: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.light-theme .dropdown-button {
    color: var(--text-color-light);
}

.dropdown-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.light-theme .dropdown-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.dropdown-text {
    font-family: var(--body-font);
}

/* Mobile user profile */
.mobile-user-profile {
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.light-theme .mobile-user-profile {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.mobile-profile-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.mobile-profile-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.light-theme .mobile-profile-img {
    border-color: rgba(0, 0, 0, 0.1);
}

.mobile-username {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

.light-theme .mobile-username {
    color: var(--text-color-light);
}

.mobile-menu-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.light-theme .mobile-menu-divider {
    background: rgba(0, 0, 0, 0.1);
}

/* Mobile top bar */
.mobile-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px; /* Increased height to accommodate larger logo */
    background-color: var(--sidebar-bg-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    display: none; /* Hidden by default, shown in media query */
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.light-theme .mobile-top-bar {
    background-color: var(--sidebar-bg-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-logo {
    width: 60%; /* Increased width for larger logo */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-wrapper svg {
    overflow: visible;
}

.mobile-logo img {
    height: 64px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
    /* Remove all complicated rendering properties that might cause issues */
    image-rendering: auto;
}

.light-theme .mobile-logo img {
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2));
}

.mobile-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.exp-circle,
.message-circle,
.mobile-profile-circle,
.mobile-settings-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-icon-bg-dark);
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.light-theme .exp-circle,
.light-theme .message-circle,
.light-theme .mobile-profile-circle,
.light-theme .mobile-settings-toggle {
    background: var(--sidebar-icon-bg-light);
    border-color: rgba(0, 0, 0, 0.1);
}

.exp-circle {
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--primary-color);
}

.light-theme .exp-circle {
    color: var(--text-color-light);
    background: rgba(255, 215, 0, 0.3);
}

.message-circle img,
.mobile-profile-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
}

.mobile-profile-circle.active {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.1);
}

.light-theme .mobile-profile-circle.active {
    border: 2px solid var(--primary-gold);
    box-shadow: 0 0 8px rgba(255, 165, 0, 0.5);
    background: rgba(255, 165, 0, 0.15);
}

.message-circle img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    padding: 2px;
    filter: brightness(0) invert(1);
}

.light-theme .message-circle img {
    filter: brightness(0.3);
}

.mobile-settings-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Mobile bottom bar */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px; /* Slightly increased to match LinkedIn exactly */
    background-color: var(--sidebar-bg-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    display: none; /* Hidden by default, shown in media query */
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.light-theme .mobile-bottom-bar {
    background-color: var(--sidebar-bg-light);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Push content towards bottom */
    text-decoration: none;
    color: white;
    font-size: 0.65rem; /* Slightly larger for better readability */
    padding: 5px 1px 1px 1px; /* Reduced bottom padding to bring icons closer */
    position: relative;
    transition: all 0.2s ease;
    font-family: var(--heading-font);
    letter-spacing: 0.02em;
}

.light-theme .mobile-nav-item {
    color: var(--text-color-light);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

.mobile-nav-icon {
    width: 35px; /* Larger icons for LinkedIn-style approach */
    height: 35px; /* Larger icons for LinkedIn-style approach */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1px; /* Reduced margin to bring icons closer to text */
    transition: all 0.2s ease;
}

/* Light theme nav icon - no background needed */

.mobile-nav-icon img {
    width: 16px; /* 10% smaller icons for better proportion */
    height: 16px; /* 10% smaller icons for better proportion */
    filter: brightness(0) invert(1);
    transition: all 0.2s ease;
}

.light-theme .mobile-nav-icon img {
    filter: brightness(0.3);
}

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

.mobile-nav-item.active .mobile-nav-icon img {
    filter: brightness(0) saturate(100%) invert(77%) sepia(53%) saturate(6526%) hue-rotate(2deg) brightness(108%) contrast(106%);
    transform: scale(1.1);
}

/* Light theme active mobile nav - keep text black, highlight icon only */
.light-theme .mobile-nav-item.active {
    color: var(--text-color-light);
}

.light-theme .mobile-nav-item.active .mobile-nav-icon img {
    filter: brightness(0) saturate(100%) invert(60%) sepia(89%) saturate(587%) hue-rotate(340deg) brightness(96%) contrast(101%);    transform: scale(1.1);
}


/* Mobile more dropdown menu */
.mobile-more-menu {
    position: relative;
}

.mobile-more-dropdown {
    position: absolute;
    bottom: 62px; /* Updated to match new bottom bar height */
    right: 0;
    width: 170px;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    padding: 12px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    animation: slideUp 0.2s ease-out;
}

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

.light-theme .mobile-more-dropdown {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.1);
}

.mobile-more-dropdown.active {
    display: flex;
}

.mobile-more-item {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    color: white;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    font-family: var(--heading-font);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.light-theme .mobile-more-item {
    color: var(--text-color-light);
}

.mobile-more-item:hover, .mobile-more-item:active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.light-theme .mobile-more-item:hover, .light-theme .mobile-more-item:active {
    background: rgba(0, 0, 0, 0.08);
}

.mobile-more-item.active {
    color: var(--primary-color);
}

.mobile-more-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.mobile-more-icon img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.light-theme .mobile-more-icon img {
    filter: brightness(0.3);
}

/* Mobile settings dropdown */
.mobile-settings-dropdown {
    position: fixed;
    top: 60px;
    right: 15px;
    width: 170px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.8rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1010;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.2s ease-out;
}

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

.light-theme .mobile-settings-dropdown {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.mobile-settings-dropdown.active {
    display: flex;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile menu container - (will be hidden on small screens now) */
.mobile-menu-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: none;
}

/* Mobile-specific styles for small screens */
@media only screen and (max-width: 620px) {
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Hide desktop elements */
    .sidebar, 
    .mobile-menu-container,
    .side-menu, 
    .menu-overlay {
        display: none !important;
        width: 0 !important;
    }
    
    /* Show mobile elements */
    .mobile-top-bar {
        display: flex !important;
        width: 100% !important;
    }
    
    .mobile-bottom-bar {
        display: flex !important;
        width: 100% !important;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0 !important;
        padding-top: 60px !important;
        padding-bottom: 50px !important; /* Reduced from 70px to match new bottom bar */
        width: 100% !important;
    }
    
    /* In mobile view, make sure dropdown is visible on screen */
    .settings-dropdown {
        left: 0;
        transform: none;
    }
}

/* Final mobile override - ensures mobile components appear */
@media screen and (max-width: 620px) {
    html, body {
        width: 100vw;
        overflow-x: hidden;
        background-attachment: initial;
        min-height: 100vh; /* Fallback */
        min-height: calc(var(--vh, 1vh) * 100);
        height: auto;
        position: relative;
    }
    
    .mobile-top-bar {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        height: 70px !important;
    }
    
    /* SVG logo styling for mobile */
    .mobile-logo .logo-wrapper {
        display: flex;
        align-items: center;
    }
    
    .mobile-logo svg {
        display: block;
        /* No filters or transforms that could affect rendering */
    }
    
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        height: 45px !important; /* Updated to match new height */
    }
    
    .sidebar, .side-menu {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding-top: 80px !important; /* Increased to match taller header */
        padding-bottom: 55px !important; /* Reduced from 80px to match new bottom bar */
        min-height: initial !important;
        height: auto !important;
        overflow-y: visible !important;
    }
    
    /* Fix for iOS safe areas */
    @supports (padding: max(0px)) {
        .mobile-top-bar {
            padding-top: max(15px, env(safe-area-inset-top));
            height: calc(70px + env(safe-area-inset-top)) !important;
        }
        
        .mobile-bottom-bar {
            padding-bottom: max(5px, env(safe-area-inset-bottom));
            height: calc(45px + env(safe-area-inset-bottom)) !important; /* Updated to match new height */
        }
        
        .main-content {
            padding-top: calc(80px + env(safe-area-inset-top)) !important;
            padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
            min-height: initial !important;
            height: auto !important;
        }
    }
}