/**
 * Veelearn Mobile Responsiveness CSS
 * Touch controls, hamburger menu, swipe gestures
 */

/* Touch targets */
.touch-target {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 16px !important;
    position: relative;
}

.touch-target:active {
    opacity: 0.7;
}

.touch-active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Hamburger menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10000;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: #374151;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu.open {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: white;
    padding: 80px 24px 24px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.mobile-menu.open .mobile-nav {
    transform: translateX(0);
}

.mobile-nav-link {
    display: block;
    padding: 16px 0;
    font-size: 18px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #e5e7eb;
    transition: color 0.2s;
}

.mobile-nav-link:hover {
    color: #667eea;
}

.mobile-nav-link:first-child {
    border-top: 1px solid #e5e7eb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }

    .mobile-menu {
        display: block;
    }

    /* Adjust course cards for mobile */
    .course-card {
        margin-bottom: 16px;
    }

    /* Adjust simulator editor for mobile */
    .simulator-editor {
        flex-direction: column;
    }

    .simulator-canvas {
        width: 100%;
        height: 300px;
    }

    .simulator-controls {
        width: 100%;
        padding: 16px;
    }

    /* Adjust buttons for mobile */
    button {
        width: 100%;
        margin-bottom: 8px;
    }

    /* Adjust forms for mobile */
    input,
    textarea,
    select {
        width: 100%;
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* Adjust modals for mobile */
    .modal-content {
        width: 95%;
        max-height: 80vh;
        margin: 10px;
        padding: 20px;
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .mobile-nav {
        width: 100%;
        max-width: none;
    }

    .hamburger-menu {
        width: 28px;
        height: 28px;
    }

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .hamburger-line {
        background: #e5e7eb;
    }

    .mobile-nav {
        background: #1f2937;
    }

    .mobile-nav-link {
        color: #e5e7eb;
        border-bottom-color: #4b5563;
    }

    .mobile-nav-link:hover {
        color: #818cf8;
    }

    .mobile-nav-link:first-child {
        border-top-color: #4b5563;
    }
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
    .mobile-nav {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
}
