/* 
 * Mobile Improvements CSS
 * Fixes for mobile-specific issues including wallet recharge and site buttons
 */

/* General mobile improvements */
@media (max-width: 767px) {
    /* Fix content overflow issues */
    body {
        overflow-x: hidden;
    }
    
    /* Improve form controls on mobile */
    input, select, textarea, .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Better touch targets */
    button, .btn, a.btn, .nav-link {
        min-height: 44px;
        padding: 10px 15px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Fix for dropdown menus on touch devices */
    .dropdown-menu {
        box-shadow: 0 6px 12px rgba(0,0,0,0.175);
    }
    
    /* Improve spacing on small screens */
    .container-fluid, .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, 
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, 
    .col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, 
    .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, 
    .col-sm-10, .col-sm-11, .col-sm-12 {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* General card improvements */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Reduce table padding */
    .table td, .table th {
        padding: 8px 10px;
    }
}

/* Fixes for Wallet Page */
@media (max-width: 767px) {
    /* Fix the recharge plans display */
    .plan-card {
        height: auto !important;
        margin-bottom: 15px;
    }
    
    /* Optimize form layout */
    #rechargeForm .form-group {
        margin-bottom: 15px;
    }
    
    /* Make sure submit button is large enough to tap */
    #rechargeForm [type="submit"] {
        width: 100%;
        padding: 12px;
        margin-top: 10px;
    }
    
    /* Fix current balance display */
    .current-balance {
        flex-direction: column;
        text-align: center;
    }
    
    /* Reorganize payment form for easier mobile use */
    #rechargeForm {
        display: flex;
        flex-direction: column;
    }
    
    /* Force all form controls to be full width */
    #rechargeForm input, 
    #rechargeForm select, 
    #rechargeForm textarea {
        width: 100%;
    }
    
    /* Fix for radio button alignment */
    #rechargeForm .form-check {
        margin-left: 0;
        padding-left: 0;
    }
    
    /* Fix for summary container */
    #summary_container .card-body {
        padding: 10px;
    }
    
    /* Fix recharge plans grid */
    .col-md-4.mb-3 {
        width: 100%;
    }
}

/* Fixes for Site Buttons */
@media (max-width: 767px) {
    /* Make site buttons bigger for touch */
    .site-button, 
    .stock-site-btn {
        min-height: 50px;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Fix site grid layout */
    .site-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Site logos should fit within their containers */
    .site-logo {
        max-width: 100%;
        height: auto;
        max-height: 40px;
    }
    
    /* Site toggles should be easy to tap */
    .site-toggle {
        width: 28px;
        height: 28px;
    }
    
    /* Fix modal dialogs */
    .modal-dialog {
        margin: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Fix dropdowns in mobile */
    .dropdown-menu {
        position: absolute !important;
        will-change: transform !important;
    }
}

/* Specific to close box in sidebar */
@media (min-width: 992px) {
    /* Hide close box in desktop sidebar */
    .sidebar-close-box {
        display: none !important;
    }
}

/* Improve touch usability */
@media (max-width: 767px) {
    /* Make sure buttons can be tapped */
    a, button, .btn, [role="button"],
    [type="button"], [type="submit"],
    [type="reset"], .nav-link {
        min-height: 44px; /* Apple's recommended minimum tap target size */
        min-width: 44px;
    }
    
    /* More spacing between tabs */
    .nav-tabs .nav-item {
        margin-bottom: -1px;
        margin-right: 5px;
    }
    
    /* Fix bottom navbar if present */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 999;
    }
    
    /* Add padding to body when bottom nav is present */
    body.has-bottom-nav {
        padding-bottom: 60px;
    }
    
    /* Fix floating buttons positioning */
    .floating-btn {
        bottom: 70px;
    }
}

/* Fix wallet page specifically */
.recharge-wallet-page .plan-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.recharge-wallet-page .plan-card:hover,
.recharge-wallet-page .plan-card.selected {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #3498db;
}

.recharge-wallet-page .plan-card .btn {
    min-height: 38px;
}

/* Fix for live support not showing up in mobile */
@media (max-width: 767px) {
    .live-chat-widget {
        bottom: 10px;
        right: 10px;
        z-index: 9999;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .chat-panel {
        width: 100%;
        height: 80vh;
        bottom: 70px;
        right: 0;
        left: 0;
        border-radius: 12px 12px 0 0;
    }
    
    .chat-panel.active {
        transform: translateY(0);
    }
}

/* Fix mobile wallet form submission */
@media (max-width: 767px) {
    /* Force form to stay visible */
    #rechargeForm {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Fix touch input focus issues */
    input:focus, textarea:focus, select:focus {
        font-size: 16px;
    }
    
    /* Make form elements more tappable */
    label {
        margin-bottom: 8px;
        display: block;
    }
    
    /* Fix payment method dropdown */
    #payment_method {
        max-height: none;
        overflow: visible;
    }
}
