/* Ultra Responsive CSS - Ensures perfect display on ALL devices */

/* ========================================
   MOBILE FIRST APPROACH - Base Styles
   ======================================== */

/* Base responsive container */
.container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive typography */
html {
    font-size: 14px; /* Base for mobile */
}

body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Responsive images */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Responsive iframes (YouTube, etc.) */
.video-container,
.iframe-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container iframe,
.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========================================
   EXTRA SMALL DEVICES (< 400px)
   ======================================== */
@media (max-width: 399px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Compact navigation */
    .nav-menu a {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
    
    /* Smaller buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Single column grids */
    .services-grid,
    .features-grid,
    .payment-grid,
    .showcase-grid,
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }
    
    /* Compact cards */
    .service-card,
    .feature-card,
    .payment-card {
        padding: 1rem !important;
    }
    
    /* Smaller hero sections */
    .hero,
    .pg3d-hero,
    .payment-hero {
        min-height: 40vh !important;
        padding: 1.5rem 0 !important;
    }
    
    .hero-title,
    .section-title {
        font-size: 1.5rem !important;
    }
    
    /* Hide decorative elements */
    .floating-icons,
    .hero-background,
    .cta-background {
        display: none !important;
    }
}

/* ========================================
   SMALL DEVICES (400px - 767px)
   ======================================== */
@media (min-width: 400px) and (max-width: 767px) {
    html {
        font-size: 14px;
    }
    
    .container {
        max-width: 540px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* 1-2 column grids */
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
        gap: 1rem !important;
    }
    
    .payment-grid {
        grid-template-columns: 1fr !important;
        gap: 1.2rem !important;
    }
    
    /* Responsive hero */
    .hero,
    .pg3d-hero,
    .payment-hero {
        min-height: 50vh;
        padding: 2rem 0;
    }
}

/* ========================================
   MEDIUM DEVICES (768px - 991px) - Tablets
   ======================================== */
@media (min-width: 768px) and (max-width: 991px) {
    html {
        font-size: 15px;
    }
    
    .container {
        max-width: 720px;
    }
    
    /* 2-3 column grids */
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    .payment-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    /* Tablet navigation */
    .nav-menu {
        flex-wrap: wrap;
        gap: 0.8rem;
    }
    
    .nav-menu a {
        font-size: 0.95rem;
    }
}

/* ========================================
   LARGE DEVICES (992px - 1199px) - Desktops
   ======================================== */
@media (min-width: 992px) and (max-width: 1199px) {
    html {
        font-size: 15px;
    }
    
    .container {
        max-width: 960px;
    }
    
    /* 3 column grids */
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
    }
    
    .payment-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
    }
}

/* ========================================
   EXTRA LARGE DEVICES (1200px - 1919px)
   ======================================== */
@media (min-width: 1200px) and (max-width: 1919px) {
    html {
        font-size: 16px;
    }
    
    .container {
        max-width: 1140px;
    }
    
    /* 3-4 column grids */
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
    }
    
    .payment-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
    }
}

/* ========================================
   ULTRA WIDE SCREENS (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    html {
        font-size: 18px;
    }
    
    .container {
        max-width: 1800px;
    }
    
    /* 4-5 column grids */
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 2.5rem !important;
    }
    
    .payment-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2.5rem !important;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION (Mobile/Tablet)
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero,
    .pg3d-hero,
    .payment-hero {
        min-height: auto !important;
        height: auto !important;
        padding: 1.5rem 0 !important;
    }
    
    .hero-title {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .hero-stats,
    .hero-features-inline {
        display: none !important;
    }
    
    .nav-menu {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

/* ========================================
   FOLDABLE DEVICES (Galaxy Fold, etc.)
   ======================================== */
@media (max-width: 280px) {
    html {
        font-size: 12px;
    }
    
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .logo {
        font-size: 0.9rem !important;
    }
    
    .nav-actions {
        gap: 0.3rem !important;
    }
    
    .cart-button,
    .theme-toggle,
    .chatbot-button {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* ========================================
   TOUCH DEVICES - Larger tap targets
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Minimum 44x44px tap targets */
    button,
    a,
    .btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .nav-menu a {
        min-height: 48px;
        padding: 1rem !important;
    }
    
    /* Remove hover effects */
    .service-card:hover,
    .feature-card:hover,
    .btn:hover {
        transform: none !important;
    }
}

/* ========================================
   HIGH DPI DISPLAYS (Retina, etc.)
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .nav-actions,
    .mobile-menu-btn,
    .back-to-top,
    .promo-banner,
    .social-share-container,
    .cta-section {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .service-card,
    .feature-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* ========================================
   ACCESSIBILITY - Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   DARK MODE RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    [data-theme="dark"] {
        --shadow-color: rgba(0, 0, 0, 0.4);
    }
    
    [data-theme="dark"] .service-card,
    [data-theme="dark"] .feature-card,
    [data-theme="dark"] .payment-card {
        border: 1px solid var(--border-color);
        box-shadow: 0 2px 8px var(--shadow-color);
    }
}

/* ========================================
   RESPONSIVE TABLES
   ======================================== */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .comparison-table {
        font-size: 0.85rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem !important;
    }
}

/* ========================================
   RESPONSIVE FORMS
   ======================================== */
@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.8rem;
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
}

/* ========================================
   RESPONSIVE MODALS
   ======================================== */
@media (max-width: 768px) {
    .modal,
    .lightbox {
        padding: 1rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
    }
}

/* ========================================
   RESPONSIVE NAVIGATION FIXES
   ======================================== */
@media (max-width: 992px) {
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--card-background);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1000;
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .mobile-nav-overlay {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 60px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .mobile-nav-overlay.active {
        display: block;
    }
}

/* ========================================
   RESPONSIVE FOOTER
   ======================================== */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .footer-section {
        padding: 1.2rem !important;
    }
    
    .social-links {
        justify-content: center;
        gap: 0.8rem;
    }
    
    .social-links a {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }
}

/* Responsive text alignment */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Responsive spacing */
@media (max-width: 768px) {
    .mt-mobile-0 { margin-top: 0 !important; }
    .mb-mobile-0 { margin-bottom: 0 !important; }
    .pt-mobile-0 { padding-top: 0 !important; }
    .pb-mobile-0 { padding-bottom: 0 !important; }
}

/* ========================================
   RESPONSIVE PERFORMANCE
   ======================================== */

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) {
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
}

/* Optimize for slow connections */
@media (prefers-reduced-data: reduce) {
    .hero-background,
    .cta-background,
    .floating-icons,
    video,
    .video-container {
        display: none !important;
    }
}
