/**
 * Professional Mobile Optimization for The Fun Sapienza Student Site
 * Ensures excellent mobile experience across all pages
 */

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    /* Global Mobile Optimizations */
    body {
        font-size: 14px;
        line-height: 1.5;
        overflow-x: hidden;
    }

    /* Container Adjustments */
    .container, .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Hero Section Mobile */
    .hero-section {
        padding: 40px 0;
        text-align: center;
    }

    .hero-title {
        font-size: 2rem !important;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .hero-btn {
        width: 100%;
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Product Cards Mobile */
    .product-card {
        margin-bottom: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .product-image-container {
        height: 180px;
    }

    .product-info {
        padding: 15px;
    }

    .product-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .product-price {
        margin: 10px 0;
    }

    .current-price {
        font-size: 1.3rem;
        font-weight: bold;
    }

    /* Feature Cards Mobile */
    .feature-card {
        padding: 20px 15px;
        text-align: center;
        margin-bottom: 20px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 15px;
        font-size: 24px;
    }

    .feature-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    /* Navigation Mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-nav-toggle {
        display: block !important;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        padding: 8px;
    }

    /* Taskbar Mobile */
    .taskbar {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-form {
        width: 100%;
        order: 3;
        margin-top: 10px;
    }

    .search-input {
        padding: 8px 12px;
        font-size: 14px;
    }

    .right-taskbar {
        gap: 15px;
    }

    /* User Profile Dropdown Mobile */
    .user-profile-dropdown {
        position: relative;
    }

    .dropdown-menu {
        position: absolute;
        right: 0;
        top: 100%;
        min-width: 200px;
        max-width: 250px;
        z-index: 1050;
    }

    /* Cart Mobile */
    .cart-icon {
        font-size: 18px;
    }

    .cart-container {
        width: 36px;
        height: 36px;
    }

    /* Orders Page Mobile */
    .orders-header {
        padding: 1.5rem 0;
        text-align: center;
    }

    .orders-header h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .orders-header .d-flex {
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .search-filter-bar {
        padding: 1rem;
    }

    .search-filter-bar .row {
        flex-direction: column;
        gap: 15px;
    }

    .search-filter-bar .d-flex {
        flex-direction: column;
        gap: 10px;
    }

    /* Order Cards Mobile */
    .order-card {
        margin-bottom: 15px;
        padding: 15px;
    }

    .order-card .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .status-badge {
        align-self: flex-end;
        margin-top: -30px;
    }

    /* Product Page Mobile */
    .product-carousel {
        margin-bottom: 20px;
    }

    .product-info-section {
        padding: 0 15px;
    }

    .product-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }

    .product-actions .btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 12px;
        font-size: 1rem;
    }

    /* Specifications Mobile */
    .specifications-table {
        font-size: 0.9rem;
    }

    .specifications-table td,
    .specifications-table th {
        padding: 8px 10px;
    }

    /* Flashcards Mobile */
    .flashcard-container {
        padding: 15px 0;
    }

    .flashcard {
        height: 200px;
        margin-bottom: 15px;
    }

    .flashcard-front,
    .flashcard-back {
        border-radius: 12px;
        font-size: 0.9rem;
    }

    /* Reviews Mobile */
    .review-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* Forms Mobile */
    .form-control,
    .form-select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 16px;
    }

    /* Modal Mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    /* Toast Notifications Mobile */
    .toast, .alert.position-fixed {
        left: 15px !important;
        right: 15px !important;
        top: 15px !important;
        max-width: none !important;
        width: auto !important;
    }

    /* Live Class Banner Mobile */
    #live-class-banner {
        left: 15px !important;
        right: 15px !important;
        top: 15px !important;
        max-width: none !important;
    }

    /* Category Cards Mobile */
    .category-card {
        margin-bottom: 20px;
    }

    .category-content {
        padding: 15px;
    }

    .category-title {
        font-size: 1.3rem;
    }

    /* Profile Page Mobile */
    .profile-header {
        text-align: center;
        padding: 20px 0;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
        margin: 0 auto 15px;
    }

    .profile-stats {
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .stat-card {
        text-align: center;
        padding: 15px;
    }

    /* Settings Page Mobile */
    .settings-nav {
        display: none;
    }

    .settings-mobile-nav {
        display: block;
        margin-bottom: 20px;
    }

    .settings-content {
        padding: 0;
    }

    /* Loading States Mobile */
    .loading-skeleton {
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .skeleton-item {
        height: 40px;
        margin-bottom: 10px;
    }

    /* Utilities Mobile */
    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }

    .d-mobile-flex {
        display: flex !important;
    }

    .text-mobile-center {
        text-align: center !important;
    }

    .p-mobile-0 {
        padding: 0 !important;
    }

    .m-mobile-0 {
        margin: 0 !important;
    }

    /* Spacing Adjustments */
    .my-5 {
        margin: 2rem 0 !important;
    }

    .py-5 {
        padding: 2rem 0 !important;
    }

    .section-title {
        font-size: 1.8rem !important;
        margin: 30px 0 20px !important;
    }

    .section-subtitle {
        font-size: 1rem !important;
        margin-bottom: 25px !important;
    }

    /* Touch Enhancements */
    .btn, .card, .product-card, .feature-card {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }

    /* Smooth Scrolling */
    html {
        scroll-behavior: smooth;
    }

    /* Safe Area Adjustments for iOS */
    @supports (padding: max(0px)) {
        .main-content {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }

        .product-actions {
            padding-bottom: max(15px, env(safe-area-inset-bottom));
        }
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.7rem !important;
    }

    .section-title {
        font-size: 1.5rem !important;
    }

    .product-card {
        border-radius: 8px;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 6px !important;
        margin-bottom: 5px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-image-container img,
    .category-card img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .card, .product-card, .feature-card, .order-card {
        background-color: #2d3748;
        color: white;
    }
    
    .modal-content {
        background-color: #2d3748;
        color: white;
    }
}
