/**
 * PayRelock - Mobile Responsive Styles
 * Safe mobile CSS that won't break desktop design
 * For both Merchant and Admin panels
 */

/* Mobile Breakpoints */
@media (max-width: 768px) {
    
    /* Sidebar - Make collapsible on mobile */
    .sidebar {
        position: relative;
        min-height: auto !important;
    }
    
    /* Container adjustments */
    .container-fluid {
        padding: 0 !important;
    }
    
    /* Cards - Better spacing on mobile */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Tables - Horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 8px !important;
        white-space: nowrap;
    }
    
    /* Buttons - Full width on mobile */
    .btn-block {
        width: 100%;
        display: block;
    }
    
    /* Stats cards - Stack vertically */
    .stat-card {
        margin-bottom: 10px;
    }
    
    /* Forms - Better spacing */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    /* Modal - Full width on mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Badges - Smaller on mobile */
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Alert messages */
    .alert {
        font-size: 14px;
        padding: 10px;
    }
    
    /* Navigation links */
    .nav-link {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Headers */
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    h5 { font-size: 14px; }
    
    /* Input groups */
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group .btn {
        white-space: nowrap;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none !important;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Small phones (< 576px) */
@media (max-width: 576px) {
    
    /* Show menu toggle button */
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Hide sidebar by default */
    .sidebar {
        display: none;
    }
    
    /* Show sidebar when active */
    .sidebar.show {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        height: 100vh;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    /* Show overlay when menu open */
    .mobile-menu-overlay.show {
        display: block;
    }
    
    /* Main content - full width */
    .col-md-10 {
        padding: 10px !important;
    }
    
    /* Stats - Stack in single column */
    .row > [class*="col-md-"] {
        margin-bottom: 10px;
    }
    
    /* Tables - Very compact */
    table {
        font-size: 11px;
    }
    
    table th,
    table td {
        padding: 5px !important;
    }
    
    /* Hide less important columns on small screens */
    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }
    
    /* Buttons - Smaller */
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    /* Action buttons - Stack */
    form[style*="display:inline"] {
        display: block !important;
        margin: 2px 0;
    }
}

/* Tablet (576px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
    
    /* Sidebar - Narrower */
    .col-md-2 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-md-10 {
        flex: 0 0 75%;
        max-width: 75%;
    }
    
    /* Tables - Show most columns */
    table {
        font-size: 12px;
    }
}

/* Landscape phones */
@media (max-height: 600px) and (orientation: landscape) {
    
    /* Reduce padding for landscape */
    body {
        padding: 0;
    }
    
    .card {
        margin-bottom: 10px;
    }
    
    .card-body {
        padding: 10px;
    }
    
    h2 {
        font-size: 18px;
        margin-bottom: 10px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Better spacing for touch */
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .btn,
    .alert,
    form {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    
    /* Sharper borders */
    .card {
        border-width: 0.5px;
    }
    
    /* Crisper text */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

