/* iOS-Style Mobile Menu */

/* Overlay */
.ios-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Menu Container */
.ios-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px 20px 0 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ios-menu.active {
    transform: translateY(0);
}

/* Handle Bar */
.ios-menu-handle {
    width: 36px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin: 12px auto 8px;
    cursor: grab;
}

/* Header */
.ios-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ios-menu-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.ios-menu-close {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 17px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ios-menu-close:active {
    opacity: 0.6;
}

/* Content */
.ios-menu-content {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

/* Menu Section */
.ios-menu-section {
    padding: 0;
}

/* Menu Items */
.ios-menu-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s ease;
    position: relative;
}

.ios-menu-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.ios-menu-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 72px;
    right: 0;
    height: 0.5px;
    background: rgba(255, 255, 255, 0.1);
}

.ios-menu-item:last-child::after {
    display: none;
}

/* Icon Wrapper */
.ios-menu-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    background: linear-gradient(135deg, var(--primary), #ffcc00);
}

/* Individual Icon Colors */
.ios-menu-icon-wrapper.quantum-icon {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
}

.ios-menu-icon-wrapper.projects-icon {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
}

.ios-menu-icon-wrapper.tech-icon {
    background: linear-gradient(135deg, #4ecdc4, #44a3aa);
}

.ios-menu-icon-wrapper.research-icon {
    background: linear-gradient(135deg, #a55eea, #8854d0);
}

.ios-menu-icon-wrapper.paper-icon {
    background: linear-gradient(135deg, #26de81, #20bf6b);
}

.ios-menu-icon-wrapper.contact-icon {
    background: linear-gradient(135deg, #fd79a8, #e84393);
}

.ios-menu-icon-wrapper svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Label */
.ios-menu-label {
    flex: 1;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Chevron */
.ios-menu-chevron {
    opacity: 0.3;
    transition: transform 0.2s ease;
}

.ios-menu-item:active .ios-menu-chevron {
    transform: translateX(2px);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Active State Animations */
.ios-menu.active .ios-menu-item {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.ios-menu.active .ios-menu-item:nth-child(1) { animation-delay: 0.05s; }
.ios-menu.active .ios-menu-item:nth-child(2) { animation-delay: 0.1s; }
.ios-menu.active .ios-menu-item:nth-child(3) { animation-delay: 0.15s; }
.ios-menu.active .ios-menu-item:nth-child(4) { animation-delay: 0.2s; }
.ios-menu.active .ios-menu-item:nth-child(5) { animation-delay: 0.25s; }
.ios-menu.active .ios-menu-item:nth-child(6) { animation-delay: 0.3s; }
.ios-menu.active .ios-menu-item:nth-child(7) { animation-delay: 0.35s; }

/* Swipe Gesture Support */
.ios-menu.dragging {
    transition: none;
}

/* Light Theme Support */
[data-theme="light"] .ios-menu {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .ios-menu-handle {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .ios-menu-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ios-menu-title,
[data-theme="light"] .ios-menu-label {
    color: #000;
}

[data-theme="light"] .ios-menu-item::after {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ios-menu-item:active {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ios-menu-chevron {
    opacity: 0.4;
}

/* Responsive */
@media (min-width: 768px) {
    .ios-menu {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 20px;
        margin-bottom: 20px;
        max-height: 70vh;
    }
    
    .ios-menu.active {
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .ios-menu,
    .ios-menu-overlay {
        transition: none;
    }
    
    .ios-menu.active .ios-menu-item {
        animation: none;
        opacity: 1;
    }
}

/* Hide old nav-menu on mobile when iOS menu is active */
@media (max-width: 1024px) {
    .nav-menu {
        display: none !important;
    }
}