/**
 * Mobile Responsive Styles
 * Author: ร้านเช่าTS4
 * Description: Mobile-first responsive styles for all components
 */

/* ========================================
   BASE MOBILE OPTIMIZATIONS
   ======================================== */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Better text rendering on mobile */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ========================================
   MOBILE UX IMPROVEMENTS (768px and below)
   ======================================== */

@media (max-width: 768px) {
    /* Safe area padding for notched devices */
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Mobile device class */
    .mobile-device .hero-section h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .mobile-device .cta-variant {
        font-size: 16px !important;
        padding: 12px 20px !important;
        min-height: 50px;
    }
    
    .mobile-device .secondary-buttons a {
        min-height: 48px;
        font-size: 12px;
        padding: 8px 12px !important;
    }
    
    /* Touch-friendly spacing */
    .mobile-device .grid {
        gap: 1.25rem;
        padding: 0 0.75rem;
    }
    
    /* Prevent zoom on double tap */
    .mobile-device * {
        touch-action: manipulation;
    }
    
    /* Hero section mobile optimizations */
    .hero-section {
        padding: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        border-radius: 16px !important;
    }
    
    /* Button responsive improvements */
    .cta-variant {
        font-size: 15px !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
    }
    
    /* Secondary buttons mobile */
    .secondary-buttons {
        gap: 0.5rem !important;
    }
    
    .secondary-buttons a {
        padding: 10px 8px !important;
        min-height: 65px !important;
        font-size: 11px !important;
        border-radius: 10px !important;
    }
    
    /* Progress indicators mobile */
    .progress-step-circle {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.875rem !important;
    }
    
    /* Features grid mobile */
    .features-grid {
        gap: 8px !important;
        max-width: 280px !important;
    }
    
    .features-grid > div {
        padding: 8px !important;
        border-radius: 8px !important;
    }
    
    /* Mobile Progress Bar */
    .progress-status-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.875rem;
    }
    
    /* Hide floating icons on mobile */
    .floating-icon {
        display: none;
    }
    
    /* Product cards mobile optimization */
    .product-card {
        margin: 0 auto;
        box-shadow: 
            0 12px 40px rgba(31, 38, 135, 0.4),
            0 6px 20px rgba(0, 0, 0, 0.12);
    }
}

/* ========================================
   SMALL MOBILE (480px and below)
   ======================================== */

@media (max-width: 480px) {
    .hero-section {
        padding: 1rem !important;
        border-radius: 16px !important;
    }
    
    .hero-title {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .cta-variant {
        font-size: 14px !important;
        padding: 12px 20px !important;
    }
    
    .secondary-buttons {
        gap: 6px !important;
    }
    
    .secondary-buttons a {
        padding: 8px 4px !important;
        min-height: 60px !important;
        font-size: 10px !important;
    }
    
    .progress-indicators {
        margin-bottom: 12px !important;
    }
    
    .progress-step-circle {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }
    
    .progress-status-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Features grid extra small */
    .features-grid {
        max-width: 260px !important;
        gap: 6px !important;
    }
    
    /* Better spacing for product cards */
    .grid {
        gap: 1rem !important;
    }
}

/* ========================================
   EXTRA SMALL MOBILE (375px and below)
   ======================================== */

@media (max-width: 375px) {
    .container {
        padding-left: max(0.625rem, env(safe-area-inset-left)) !important;
        padding-right: max(0.625rem, env(safe-area-inset-right)) !important;
    }
    
    .grid {
        gap: 0.875rem !important;
        padding: 0 0.375rem !important;
    }
    
    .hero-title {
        font-size: 1.1rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.9rem !important;
    }
    
    .cta-variant {
        font-size: 13px !important;
        padding: 11px 18px !important;
    }
}

/* ========================================
   VERY SMALL MOBILE (320px and below)
   ======================================== */

@media (max-width: 320px) {
    .container {
        padding-left: max(0.5rem, env(safe-area-inset-left)) !important;
        padding-right: max(0.5rem, env(safe-area-inset-right)) !important;
    }
    
    .grid {
        gap: 0.75rem !important;
        padding: 0 0.25rem !important;
    }
    
    .hero-title {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }
    
    .hero-subtitle {
        font-size: 0.85rem !important;
    }
    
    .cta-variant {
        font-size: 12px !important;
        padding: 10px 16px !important;
    }
    
    .features-grid {
        max-width: 240px !important;
    }
}

/* ========================================
   TABLET RESPONSIVE (768px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-section {
        padding: 2rem !important;
    }
    
    .cta-variant {
        font-size: 16px !important;
        padding: 16px 32px !important;
    }
    
    .secondary-buttons a {
        min-height: 75px !important;
        font-size: 13px !important;
    }
    
    .progress-step-circle {
        width: 48px !important;
        height: 48px !important;
    }
}

/* ========================================
   LANDSCAPE MOBILE OPTIMIZATION
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 1rem !important;
    }
    
    .hero-title {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.875rem !important;
        margin-bottom: 1rem !important;
    }
    
    .cta-variant {
        padding: 10px 20px !important;
        font-size: 14px !important;
    }
    
    .secondary-buttons a {
        min-height: 50px !important;
        font-size: 10px !important;
    }
    
    .features-grid > div {
        padding: 6px !important;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (pointer: coarse) {
    /* Ensure touch targets are at least 44px */
    button, 
    a,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger tap areas for small buttons */
    .secondary-buttons a {
        min-height: 48px;
    }
    
    /* Better spacing for touch */
    .cta-variant {
        margin: 0.5rem 0;
    }
}

/* ========================================
   HIGH DPI DISPLAYS
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
    /* Sharper shadows and borders for retina displays */
    .hero-section {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
    
    .cta-variant {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
    
    .progress-step-circle {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}
