/* ============================================
   MOBILE OPTIMIZATION - VIBRANT KASHI
   ============================================ */

/* ============================================
   1. TOUCH-FRIENDLY INTERACTIONS
   ============================================ */

/* Increase tap targets for mobile */
@media (max-width: 768px) {
    /* Minimum 44x44px tap targets */
    button,
    a,
    input[type="submit"],
    input[type="button"],
    .btn,
    .cta-button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    /* Larger form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }

    /* Prevent text zoom on landscape */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ============================================
   2. RESPONSIVE IMAGES
   ============================================ */

/* Prevent layout shift */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading optimization */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   3. MOBILE NAVIGATION
   ============================================ */

@media (max-width: 1024px) {
    /* Sticky header optimization */
    .sticky-header {
        position: sticky;
        top: 0;
        z-index: 50;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    /* Mobile menu improvements */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 100;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Prevent body scroll when menu open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* ============================================
   4. TYPOGRAPHY OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Readable font sizes */
    body {
        font-size: 14px;
        line-height: 1.6;
    }

    h1 {
        font-size: 24px;
        line-height: 1.3;
    }

    h2 {
        font-size: 20px;
        line-height: 1.4;
    }

    h3 {
        font-size: 18px;
        line-height: 1.4;
    }

    h4 {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Better readability */
    p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 16px;
    }
}

/* ============================================
   5. SPACING & LAYOUT
   ============================================ */

@media (max-width: 768px) {
    /* Reduce padding on mobile */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Stack columns */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    /* Reduce gaps */
    .gap-8 {
        gap: 16px;
    }

    .gap-6 {
        gap: 12px;
    }
}

/* ============================================
   6. MODAL & POPUP OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Full-screen modals on mobile */
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    /* Bottom sheet style */
    .bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
}

/* ============================================
   7. STICKY ELEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Sticky CTA bar mobile optimization */
    .sticky-cta-bar {
        padding: 12px 16px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    /* Ensure it doesn't block content */
    .sticky-cta-bar + * {
        padding-bottom: 80px;
    }

    /* WhatsApp widget positioning */
    .whatsapp-widget {
        bottom: 80px; /* Above sticky CTA */
        right: 16px;
    }
}

/* ============================================
   8. PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPU acceleration for smooth animations */
.animate-smooth {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================
   9. FORM OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Full-width form fields */
    .form-group {
        margin-bottom: 16px;
    }

    input,
    select,
    textarea {
        width: 100%;
        border-radius: 8px;
    }

    /* Larger submit buttons */
    button[type="submit"],
    input[type="submit"] {
        width: 100%;
        padding: 16px;
        font-size: 16px;
        font-weight: 600;
    }

    /* Error messages */
    .error-message {
        font-size: 13px;
        margin-top: 4px;
    }
}

/* ============================================
   10. CARD OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Package/Hotel cards */
    .card {
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .card-image {
        height: 200px;
        object-fit: cover;
    }

    .card-content {
        padding: 16px;
    }

    /* Horizontal cards on mobile */
    .card-horizontal {
        display: flex;
        flex-direction: row;
    }

    .card-horizontal .card-image {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }
}

/* ============================================
   11. TABLE RESPONSIVENESS
   ============================================ */

@media (max-width: 768px) {
    /* Convert tables to cards */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Alternative: Stack table cells */
    .responsive-table thead {
        display: none;
    }

    .responsive-table tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 12px;
    }

    .responsive-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .responsive-table td:before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 16px;
    }
}

/* ============================================
   12. SWIPE GESTURES
   ============================================ */

/* Enable smooth horizontal scrolling */
.scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}

.scroll-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.scroll-item {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* ============================================
   13. SAFE AREA INSETS (iPhone X+)
   ============================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .sticky-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .sticky-cta-bar {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   14. ORIENTATION CHANGES
   ============================================ */

@media (orientation: landscape) and (max-height: 500px) {
    /* Reduce header height in landscape */
    .header {
        padding: 8px 0;
    }

    /* Hide non-essential elements */
    .hide-landscape {
        display: none;
    }
}

/* ============================================
   15. ACCESSIBILITY
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #F57C00;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0B3C5D;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   16. LOADING STATES
   ============================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #F57C00;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   17. PRINT STYLES
   ============================================ */

@media print {
    /* Hide non-essential elements */
    .no-print,
    header,
    footer,
    .whatsapp-widget,
    .sticky-cta-bar,
    nav {
        display: none !important;
    }

    /* Optimize for printing */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }

    a {
        text-decoration: underline;
        color: black;
    }

    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* ============================================
   18. DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    body {
        background: #1a1a1a;
        color: #ffffff;
    }

    .card {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }
    */
}

/* ============================================
   19. UTILITY CLASSES
   ============================================ */

/* Mobile-only visibility */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    .desktop-only {
        display: none;
    }
}

/* Text truncation */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   20. PERFORMANCE HINTS
   ============================================ */

/* Optimize rendering */
.optimize-rendering {
    contain: layout style paint;
}

/* Lazy load images */
img[loading="lazy"] {
    content-visibility: auto;
}

/* Reduce repaints */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}
