/* ===================================
   MOBILE HAMBURGER MENU STYLES
   =================================== */

/* Modern Hamburger Button - Visible on all screens */
.mobile-hamburger {
    display: flex;
    /* Now visible on desktop too */
    position: relative;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: visible;
    margin-right: 0;
    flex-shrink: 0;
}

.mobile-hamburger:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-hamburger:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Hamburger Icon Container */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: 100%;
}

/* Modern Hamburger Lines */
.hamburger-line {
    display: block;
    width: 24px;
    height: 2.5px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 1));
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Tooltip */
.hamburger-tooltip {
    position: absolute;
    left: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hamburger-tooltip::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 4px solid rgba(0, 0, 0, 0.9);
}

.mobile-hamburger:hover .hamburger-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

/* Animate hamburger to X when menu is open */
.mobile-hamburger.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    border-width: 2px;
}

.mobile-hamburger.active:hover {
    background: rgba(239, 68, 68, 0.3);
}

.mobile-hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
    background: linear-gradient(90deg, rgba(239, 68, 68, 1), rgba(220, 38, 38, 1));
    height: 2.5px;
}

.mobile-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0) rotate(180deg);
}

.mobile-hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
    background: linear-gradient(90deg, rgba(239, 68, 68, 1), rgba(220, 38, 38, 1));
    height: 2.5px;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    /* width: 132px; */
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* momentum scrolling on iOS */
    touch-action: pan-y;
    /* allow vertical touch scrolling */
}

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

/* Mobile Menu Content */
.mobile-menu-content {
    position: relative;
    width: 100%;
    max-width: 320px;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea54 0%, #764ba232 100%);
    margin-left: 0;
    margin-right: auto;
    padding: 12px;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    /* ensure the content itself can scroll */
    -webkit-overflow-scrolling: touch;
    /* smooth scrolling on iOS */
    touch-action: pan-y;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 12px;
}

.mobile-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

.mobile-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

.mobile-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.mobile-close-btn svg {
    width: 90px;
    height: 90px;
    color: rgb(255, 0, 0);
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

*/

/* Mobile User Section */
.mobile-user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.mobile-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.mobile-user-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-email {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Account Type Badge in Mobile Menu */
.mobile-user-info .account-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 9999px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-user-info .account-type-icon {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
}

/* Mobile Navigation Links */
.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-nav-item:hover {
    background: rgba(55, 0, 255, 0.37);
    border-color: rgb(4, 0, 0);
    transform: translateX(5px);
}

.mobile-nav-item.active {
    background: rgba(9, 157, 76, 0.484);
    border-color: rgb(255, 255, 255);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Mobile Menu Divider */
.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

/* Mobile Menu Section */
.mobile-menu-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.mobile-menu-item:hover {
    background: rgba(10, 32, 177, 0.509);
    transform: translateX(5px);
}

.mobile-menu-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.mobile-menu-item.logout {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    margin-top: 10px;
}

.mobile-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Mobile Auth Section (for non-authenticated users) */
.mobile-auth-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mobile-btn-icon {
    width: 22px;
    height: 22px;
}

.mobile-login-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-login-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.mobile-signup-btn {
    background: white;
    color: #667eea;
}

.mobile-signup-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ===================================
   RESPONSIVE STYLES
   =================================== */

/* Desktop - Hamburger visible as part of navbar */
@media (min-width: 769px) {
    .mobile-hamburger {
        display: flex;
        /* Visible on desktop */
        width: 40px;
        height: 40px;
    }

    .hamburger-line {
        width: 20px;
        height: 2px;
    }

    .mobile-hamburger.active .hamburger-line:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .mobile-hamburger.active .hamburger-line:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .mobile-hamburger {
        display: flex;
        /* Show hamburger on mobile */
        width: 50px;
        height: 50px;
    }

    .hamburger-tooltip {
        display: none;
        /* Hide tooltip on mobile */
    }

    /* Hide desktop navigation */
    .nav-island {
        display: none !important;
    }

    /* Adjust header layout for mobile */
    .glass-navbar {
        justify-content: space-between;
        padding: 0 10px;
        gap: 10px;
        width: calc(100% - 20px);
        top: 10px;
    }

    .logo-circle-island {
        margin-right: 0;
    }

    /* Make sure hamburger is properly styled like other glass islands */
    .mobile-hamburger {
        margin-left: 0;
        flex-shrink: 0;
    }

    /* Adjust user island on mobile if present */
    .user-island {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Very small mobile devices */
@media (max-width: 480px) {
    .mobile-menu-content {
        width: 90%;
    }

    .mobile-nav-item,
    .mobile-menu-item {
        padding: 12px 14px;
        font-size: 14px;
    }

    .mobile-avatar {
        width: 50px;
        height: 50px;
    }

    .mobile-user-name {
        font-size: 15px;
    }

    .mobile-user-email {
        font-size: 12px;
    }

    /* Smaller hamburger on very small screens */
    .mobile-hamburger {
        width: 46px;
        height: 46px;
        top: 8px;
        left: 8px;
    }

    .hamburger-line {
        width: 24px;
        height: 2.5px;
    }

    .mobile-hamburger.active .hamburger-line:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }

    .mobile-hamburger.active .hamburger-line:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    /* Adjust navbar spacing */
    .glass-navbar {
        gap: 8px;
        width: calc(100% - 16px);
        top: 8px;
    }

    /* Hide user island on very small screens to make room */
    .user-island {
        display: none !important;
    }
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Animation for menu items - stagger effect */
.mobile-menu-overlay.active .mobile-nav-item,
.mobile-menu-overlay.active .mobile-menu-item {
    animation: slideInFromRight 0.3s ease forwards;
    opacity: 0;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(1) {
    animation-delay: 0.1s;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(2) {
    animation-delay: 0.15s;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(3) {
    animation-delay: 0.2s;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(4) {
    animation-delay: 0.25s;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(5) {
    animation-delay: 0.3s;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(6) {
    animation-delay: 0.35s;
}

.mobile-menu-overlay.active .mobile-menu-item:nth-child(1) {
    animation-delay: 0.4s;
}

.mobile-menu-overlay.active .mobile-menu-item:nth-child(2) {
    animation-delay: 0.45s;
}

.mobile-menu-overlay.active .mobile-menu-item:nth-child(3) {
    animation-delay: 0.5s;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}