/* ========================================
   STARPAY - MOBILE RESPONSIVE STYLES
   All device sizes covered
   ======================================== */

/* ===== Small Mobile (320px - 480px) ===== */
@media (max-width: 480px) {
    /* Typography */
    h1 { font-size: 28px !important; line-height: 1.2 !important; }
    h2 { font-size: 24px !important; }
    h3 { font-size: 20px !important; }
    h4 { font-size: 18px !important; }
    p { font-size: 14px !important; }
    
    /* Container & Spacing */
    .container { padding: 0 16px !important; }
    section { padding: 40px 0 !important; }
    
    /* Buttons */
    .btn, button { 
        padding: 12px 20px !important; 
        font-size: 14px !important;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Forms */
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }
    
    /* Cards */
    .card, .feature-card, .demo-card {
        margin-bottom: 16px !important;
        padding: 16px !important;
    }
    
    /* Grid Layouts */
    .grid, .hero-grid, .feature-grid, .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    /* Navbar */
    .nav-links { display: none !important; }
    .mobile-menu-btn { display: flex !important; }
    .logo { font-size: 20px !important; }
    
    /* Hero Section */
    .hero {
        padding: 100px 0 60px !important;
        text-align: center;
    }
    
    .hero-btns {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* ===== Medium Mobile (481px - 640px) ===== */
@media (min-width: 481px) and (max-width: 640px) {
    h1 { font-size: 32px !important; }
    h2 { font-size: 26px !important; }
    .container { padding: 0 20px !important; }
    
    .grid, .feature-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== Tablet (641px - 768px) ===== */
@media (min-width: 641px) and (max-width: 768px) {
    .container { padding: 0 24px !important; }
    
    .grid, .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .hero-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== Large Tablet / Small Desktop (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 960px !important;
        padding: 0 32px !important;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== Landscape Mobile ===== */
@media (max-height: 480px) and (orientation: landscape) {
    .hero {
        padding: 80px 0 40px !important;
    }
    
    .modal, .sidebar {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets */
    a, button, .btn, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    *:hover {
        transition: none !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    .navbar, footer, .btn, .sidebar {
        display: none !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

/* ===== High DPI Screens ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ===== SPECIFIC COMPONENT FIXES ===== */

/* Login/Register Cards */
@media (max-width: 480px) {
    .login-card, .register-card {
        padding: 30px 24px !important;
        margin: 10px !important;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
}

/* Dashboard Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Data Tables */
@media (max-width: 640px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 13px !important;
    }
    
    th, td {
        padding: 8px 6px !important;
    }
}

/* Stats Cards */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stat-card {
        min-height: auto !important;
    }
}

/* Modals */
@media (max-width: 640px) {
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
    }
    
    .modal-body {
        padding: 16px !important;
    }
}

/* Footer */
@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
    }
    
    .footer-col {
        margin-bottom: 24px;
    }
}

/* Checkout Page */
@media (max-width: 375px) {
    #app {
        width: 100vw !important;
        max-width: 100vw !important;
    }
    
    .tabs-box .tabs {
        width: 95% !important;
    }
    
    .payment-channel {
        width: 95% !important;
    }
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 9999;
        transition: left 0.3s;
        overflow-y: auto;
    }
    
    .mobile-sidebar.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Pricing Cards */
@media (max-width: 640px) {
    .pricing-card {
        margin-bottom: 20px;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* Text Alignment */
@media (max-width: 640px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

/* Flexbox Mobile Fixes */
@media (max-width: 640px) {
    .flex-wrap-mobile {
        flex-wrap: wrap !important;
    }
    
    .flex-column-mobile {
        flex-direction: column !important;
    }
}

/* Utility Classes */
.d-none-mobile { display: block; }
.d-block-mobile { display: none; }

@media (max-width: 768px) {
    .d-none-mobile { display: none !important; }
    .d-block-mobile { display: block !important; }
}

/* Safe Area for Notch Devices (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));
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

* {
    max-width: 100%;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* iOS Input Fix */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

/* Disable pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}
