/* ================================
   MOBILE OPTIMIZATION ENHANCEMENTS
   Culinary Creation Academy
   ================================ */

/* Mobile-First Approach - Enhanced Styles */

/* Touch-Friendly Elements */
@media (max-width: 768px) {

    /* Prevent horizontal scrolling */
    html,
    body {
        max-width: 100vw;
        overflow-x: hidden;
        width: 100%;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        touch-action: pan-y pinch-zoom;
    }

    * {
        max-width: 100%;
        -webkit-tap-highlight-color: transparent;
    }

    .container {
        padding: 0 15px;
        width: 100%;
    }

    .row {
        margin: 0 -10px;
        width: 100%;
    }

    .section {
        width: 100%;
        overflow-x: hidden;
    }

    .nav-menu a,
    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Enhanced Mobile Navigation - Native App Style */
    .header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999 !important;
        background: #1D3557 !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
        padding: 0.75rem 0;
    }

    .nav {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        border-radius: 8px;
        transition: all 0.3s ease;
        z-index: 10001;
    }

    .mobile-menu-toggle:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-toggle span {
        width: 28px;
        height: 3px;
        background: #FFFFFF;
        border-radius: 3px;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Full Screen Native App Menu */
    .nav-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: #1D3557 !important;
        flex-direction: column !important;
        padding: 0 !important;
        box-shadow: none !important;
        transform: translateX(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        gap: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 10000 !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        display: flex !important;
        padding-top: 80px !important;
        padding-bottom: 40px !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        pointer-events: none !important;
        min-height: 100vh !important;
    }

    .nav-menu.active {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        touch-action: pan-y !important;
    }

    .nav-menu li {
        width: 100%;
        text-align: left;
        margin-bottom: 0 !important;
        animation: slideInRight 0.3s ease forwards;
        opacity: 0;
        flex-shrink: 0 !important;
    }

    .nav-menu.active li {
        opacity: 1;
    }

    .nav-menu.active li:nth-child(1) {
        animation-delay: 0.1s;
    }

    .nav-menu.active li:nth-child(2) {
        animation-delay: 0.15s;
    }

    .nav-menu.active li:nth-child(3) {
        animation-delay: 0.2s;
    }

    .nav-menu.active li:nth-child(4) {
        animation-delay: 0.25s;
    }

    .nav-menu.active li:nth-child(5) {
        animation-delay: 0.3s;
    }

    .nav-menu.active li:nth-child(6) {
        animation-delay: 0.35s;
    }

    .nav-menu.active li:nth-child(7) {
        animation-delay: 0.4s;
    }

    @keyframes slideInRight {
        from {
            transform: translateX(-20px);
            opacity: 0;
        }

        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    /* Native App Style Menu Items */
    .nav-item-dropdown {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }

    .dropdown-trigger {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px;
        cursor: pointer;
        padding: 16px 20px !important;
        margin-bottom: 8px;
        font-size: 16px !important;
        color: #FFFFFF !important;
        font-weight: 500 !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }

    .dropdown-trigger:active {
        background: rgba(255, 255, 255, 0.15) !important;
        transform: scale(0.98);
    }

    .dropdown-trigger i {
        margin-left: auto;
        transition: transform 0.3s ease;
        font-size: 14px;
    }

    .nav-item-dropdown.active .dropdown-trigger {
        background: rgba(255, 255, 255, 0.15) !important;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .nav-item-dropdown.active .dropdown-trigger i {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 0 0 12px 12px !important;
        padding: 0 !important;
        margin: 0 0 8px 0 !important;
        box-shadow: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.3s ease !important;
    }

    .nav-item-dropdown.active .dropdown-menu {
        max-height: 500px !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 8px !important;
    }

    .dropdown-menu li {
        margin: 4px 0 !important;
        width: 100% !important;
        text-align: left !important;
    }

    .dropdown-menu a {
        display: block !important;
        padding: 12px 20px !important;
        font-size: 15px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border-radius: 8px !important;
        margin-bottom: 0 !important;
        box-shadow: none !important;
        color: rgba(255, 255, 255, 0.9) !important;
        text-align: left !important;
        font-weight: 400 !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        transition: all 0.2s ease !important;
    }

    .dropdown-menu a:active {
        background: rgba(255, 255, 255, 0.15) !important;
        color: #FFFFFF !important;
        transform: scale(0.98) !important;
    }

    /* Main Navigation Links */
    .nav-menu>li>a {
        display: block !important;
        padding: 16px 20px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        margin-bottom: 8px !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        transition: all 0.3s ease !important;
        color: #FFFFFF !important;
        text-align: left !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .nav-menu>li>a:active {
        background: rgba(255, 255, 255, 0.15) !important;
        transform: scale(0.98);
    }

    .nav-menu>li>a.active {
        background: rgba(255, 107, 0, 0.3) !important;
        border-color: rgba(255, 107, 0, 0.5) !important;
    }

    /* Remove underline effect on mobile */
    .nav-menu a::after {
        display: none !important;
    }

    /* Action Buttons */
    .nav-menu .btn {
        background: #FF6B00 !important;
        color: white !important;
        margin-top: 12px !important;
        padding: 16px 20px !important;
        font-weight: 600 !important;
        border: 2px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3) !important;
    }

    .nav-menu .btn-primary {
        background: linear-gradient(135deg, #3498db, #2980b9) !important;
        margin-top: 20px !important;
    }

    .nav-menu .btn-accent {
        background: linear-gradient(135deg, #FF6B00, #e65c00) !important;
    }

    .nav-menu .btn:active {
        transform: scale(0.97);
    }

    /* Add extra space after last menu item */
    .nav-menu li:last-child {
        margin-bottom: 40px !important;
    }

    /* Custom scrollbar for mobile menu */
    .nav-menu::-webkit-scrollbar {
        width: 4px;
    }

    .nav-menu::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }

    .nav-menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }

    .nav-menu::-webkit-scrollbar-thumb:active {
        background: rgba(255, 255, 255, 0.5);
    }

    .admin-link {
        background: rgba(230, 126, 34, 0.2) !important;
        border-radius: 12px !important;
        width: auto !important;
        height: auto !important;
        margin: 1rem 0 !important;
        border: 1px solid rgba(230, 126, 34, 0.3) !important;
    }

    /* Logo optimization */
    .logo {
        z-index: 10001 !important;
        position: relative;
    }

    .logo-text {
        font-size: 1rem;
        display: none;
    }

    .logo-img {
        width: 45px;
        height: 45px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    /* Hero Section Mobile */
    .hero {
        padding: 6rem 0 4rem 0;
        text-align: center;
        width: 100%;
        overflow-x: hidden;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
        padding: 0 15px;
    }

    .hero-content h1 {
        font-size: 2.5rem;
        \n font-size: clamp(1.8rem, 8vw, 2.5rem);
        \n line-height: 1.2;
        \n margin-bottom: 1.5rem;
        \n word-wrap: break-word;
        \n overflow-wrap: break-word;
        \n
    }

    \n\n .hero-content p {
        \n font-size: 1.1rem;
        \n font-size: clamp(1rem, 4vw, 1.1rem);
        \n line-height: 1.6;
        \n margin-bottom: 2rem;
        \n word-wrap: break-word;
        \n overflow-wrap: break-word;
        \n
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        width: 100%;
        padding: 0 15px;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 280px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        white-space: normal;
    }

    /* Cards and Grid Optimization */
    .row {
        flex-direction: column;
        gap: 2rem;
    }

    .col-2,
    .col-3,
    .col-4 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        padding: 0 10px;
    }

    /* Typography constraints */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    h1 {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    h2 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    h3 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    p,
    span,
    a,
    div {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Buttons constraints */
    .btn {
        max-width: 100%;
        white-space: normal;
        padding: 0.875rem 1.5rem;
    }

    .card {
        margin-bottom: 1rem;
        padding: 2rem 1.5rem;
    }

    .card-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .card-text {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Course Cards Mobile */
    .course-card {
        margin-bottom: 2rem;
    }

    .course-image {
        height: 200px;
    }

    .course-content {
        padding: 1.5rem;
    }

    .course-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .course-price {
        font-size: 1.5rem;
        margin: 1rem 0;
    }

    /* Images Mobile Optimization */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Tables Mobile Optimization */
    table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }

    /* Forms Mobile Optimization */
    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        font-weight: 500;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
        border: 2px solid #e0e0e0;
        width: 100%;
        transition: all 0.3s ease;
    }

    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
    }

    /* Contact Form Mobile */
    .contact-form {
        padding: 2rem 1.5rem;
    }

    .contact-info {
        margin-bottom: 3rem;
        text-align: center;
    }

    .contact-item {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .contact-icon {
        margin-bottom: 1rem;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    /* Gallery Mobile */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gallery-item {
        height: 250px;
        border-radius: 15px;
    }

    /* ChefBot Mobile */
    .chefbot-widget {
        bottom: 1rem;
        right: 1rem;
        width: 60px;
        height: 60px;
    }

    .chefbot-toggle {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .chefbot-container {
        bottom: 80px;
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
        border-radius: 20px 20px 0 0;
    }

    .chefbot-header {
        padding: 1.5rem;
    }

    .chefbot-messages {
        max-height: 300px;
        padding: 1rem;
    }

    .message {
        margin-bottom: 1rem;
        padding: 1rem;
        border-radius: 12px;
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .chefbot-input-container {
        padding: 1rem;
        gap: 0.75rem;
    }

    .chefbot-input {
        padding: 1rem;
        border-radius: 25px;
        font-size: 1rem;
    }

    .chefbot-send {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    /* Footer Mobile */
    .footer {
        text-align: center;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-section {
        text-align: center;
    }

    .footer-section h3 {
        margin-bottom: 1.5rem;
    }

    .social-links {
        justify-content: center;
        gap: 1rem;
    }

    .social-links a {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Accreditation Mobile */
    .accreditation-banner {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 2rem 1rem;
    }

    .accreditation-badge-container {
        justify-content: center;
    }

    .accreditation-badge-logo {
        width: 60px;
        height: 60px;
    }

    .certification-info {
        font-size: 0.9rem;
    }

    /* Animation Improvements */
    .card:hover {
        transform: translateY(-5px);
    }

    .btn:hover {
        transform: translateY(-2px);
    }

    /* Improved Typography */
    h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 2rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.5rem;
        line-height: 1.4;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Section Spacing */
    .section {
        padding: 4rem 0;
    }

    .section-title {
        margin-bottom: 3rem;
        text-align: center;
    }

    .section-title h2 {
        margin-bottom: 1rem;
    }

    .section-title p {
        font-size: 1.1rem;
        color: #666;
    }
}

/* Extra Small Devices (phones in portrait) */
@media (max-width: 480px) {

    /* Container adjustments */
    .container {
        padding: 0 1rem;
    }

    /* Typography adjustments */
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.1;
    }

    .hero-content p {
        font-size: 1rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Button adjustments */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .hero-buttons .btn {
        padding: 1rem 1.5rem;
    }

    /* Card adjustments */
    .card {
        padding: 1.5rem 1rem;
    }

    /* Form adjustments */
    .contact-form {
        padding: 1.5rem 1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.875rem;
    }

    /* ChefBot adjustments */
    .chefbot-container {
        bottom: 70px;
        border-radius: 15px 15px 0 0;
    }

    .chefbot-header {
        padding: 1rem;
    }

    .chefbot-messages {
        max-height: 250px;
        padding: 0.75rem;
    }

    .message {
        padding: 0.875rem;
        font-size: 0.9rem;
    }

    .chefbot-input-container {
        padding: 0.75rem;
    }

    .chefbot-input {
        padding: 0.875rem;
    }

    .chefbot-send {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    /* Gallery adjustments */
    .gallery-item {
        height: 200px;
        border-radius: 12px;
    }

    /* Section adjustments */
    .section {
        padding: 3rem 0;
    }

    .section-title {
        margin-bottom: 2rem;
    }

    /* Footer adjustments */
    .footer {
        padding: 2rem 0;
    }

    .social-links a {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    /* Accreditation adjustments */
    .accreditation-banner {
        padding: 1.5rem 1rem;
        gap: 1rem;
    }

    .accreditation-badge-logo {
        width: 50px;
        height: 50px;
    }

    .certification-info {
        font-size: 0.85rem;
    }
}

/* Landscape orientation optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 3rem 0 2rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
    }

    .hero-buttons .btn {
        width: auto;
        max-width: 200px;
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .section {
        padding: 3rem 0;
    }

    .chefbot-messages {
        max-height: 200px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .logo-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .gallery-item img,
    .course-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .nav-menu {
        background: rgba(44, 62, 80, 0.98);
    }

    .nav-menu a {
        color: white;
        background: rgba(255, 255, 255, 0.05);
    }

    .nav-menu a:hover {
        background: rgba(230, 126, 34, 0.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus improvements for accessibility */
@media (max-width: 768px) {

    .btn:focus,
    .nav-menu a:focus,
    .mobile-menu-toggle:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }

    /* Skip link for screen readers */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: var(--primary-color);
        color: white;
        padding: 8px;
        z-index: 10000;
        text-decoration: none;
        border-radius: 4px;
    }

    .skip-link:focus {
        top: 6px;
    }
}

/* Improved touch scrolling */
* {
    -webkit-overflow-scrolling: touch;
}

/* Prevent zoom on form inputs */
@media (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Form validation styles */
.form-group input.error,
.form-group textarea.error,
.form-group select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠";
    font-size: 1rem;
}

/* Scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Header scroll states */
.header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 30px rgba(0, 0, 0, 0.1);
}

.header.scroll-down {
    transform: translateY(-100%);
}

.header.scroll-up {
    transform: translateY(0);
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 10000;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}

.skip-link:focus {
    top: 6px;
}

/* Improved loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.6),
            transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    100% {
        left: 100%;
    }
}

/* Enhanced viewport support */
.hero {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* Enhanced touch interactions */
@media (max-width: 768px) {

    .btn,
    .nav-menu a,
    .mobile-menu-toggle,
    .chefbot-toggle {
        -webkit-tap-highlight-color: rgba(230, 126, 34, 0.2);
        tap-highlight-color: rgba(230, 126, 34, 0.2);
    }

    /* Improved button states */
    .btn:active {
        transform: translateY(1px) scale(0.98);
    }

    .nav-menu a:active {
        background: rgba(230, 126, 34, 0.15);
    }

    /* Better form focus states */
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        transform: scale(1.02);
        transition: all 0.2s ease;
    }
}