/* 
Benica Commission Management System
Mobile-Specific CSS
Enhanced Mobile User Experience
*/

/* ===== MOBILE-FIRST BREAKPOINTS ===== */
/* Small devices (576px and up) */
@media (min-width: 576px) { 
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Medium devices (768px and up) */
@media (min-width: 768px) { 
    .mobile-only {
        display: none !important;
    }
}

/* Large devices (992px and up) */
@media (min-width: 992px) { 
    .mobile-bottom-nav {
        display: none !important;
    }
}

/* ===== MOBILE NAVIGATION ===== */
.mobile-bottom-nav {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    height: 60px;
}

.mobile-bottom-nav .nav-link {
    padding: 0.5rem 0.25rem !important;
    min-height: 50px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.mobile-bottom-nav .nav-link i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

/* ===== MOBILE TOUCH TARGETS ===== */
/* Ensure touch targets are at least 44px for accessibility */
@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 0.5rem 0.75rem;
    }
    
    .form-control {
        min-height: 44px;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .form-select {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    .nav-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
}

/* ===== MOBILE CARDS AND LAYOUTS ===== */
@media (max-width: 767.98px) {
    /* Reduce card padding on mobile */
    .card-body {
        padding: 1rem;
    }
    
    /* Stack stat cards on mobile */
    .card-stat {
        margin-bottom: 1rem;
    }
    
    /* Smaller stat numbers on mobile */
    .card-stat .stat-number {
        font-size: 1.75rem;
    }
    
    /* Adjust dashboard header for mobile */
    .admin-dashboard h1,
    .staff-dashboard h1 {
        font-size: 1.5rem;
    }
    
    /* Mobile-friendly table scrolling */
    .table-responsive {
        border-radius: 0.375rem;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
}

/* ===== MOBILE FORMS ===== */
@media (max-width: 767.98px) {
    /* Full-width form elements on mobile */
    .form-floating {
        margin-bottom: 1rem;
    }
    
    /* Larger form labels for readability */
    .form-label {
        font-size: 0.95rem;
        font-weight: 600;
    }
    
    /* Better spacing for form groups */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Responsive form buttons */
    .btn-group-vertical {
        width: 100%;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.5rem;
    }
}

/* ===== MOBILE TABLES ===== */
@media (max-width: 767.98px) {
    /* Hide table headers and display as cards */
    .table-mobile-cards thead {
        display: none;
    }
    
    .table-mobile-cards,
    .table-mobile-cards tbody,
    .table-mobile-cards tr,
    .table-mobile-cards td {
        display: block;
    }
    
    .table-mobile-cards tr {
        border: 1px solid var(--gray-300);
        border-radius: 0.375rem;
        margin-bottom: 1rem;
        padding: 1rem;
        background: white;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    
    .table-mobile-cards td {
        border: none;
        position: relative;
        padding-left: 35% !important;
        padding-bottom: 0.75rem;
        word-break: break-word;
    }
    
    .table-mobile-cards td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        top: 0;
        font-weight: 600;
        color: var(--gray-700);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
    
    .table-mobile-cards td:last-child {
        padding-bottom: 0;
    }
}

/* ===== MOBILE MODALS ===== */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid var(--gray-200);
    }
}

/* ===== MOBILE ALERTS ===== */
@media (max-width: 767.98px) {
    .flash-messages-container {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        z-index: 1050;
    }
    
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    .alert .btn-close {
        padding: 0.5rem;
    }
}

/* ===== MOBILE CHARTS ===== */
@media (max-width: 767.98px) {
    .chart-container {
        position: relative;
        height: 250px;
        margin: 1rem 0;
    }
    
    canvas {
        max-height: 250px !important;
    }
}

/* ===== MOBILE DROPDOWNS ===== */
@media (max-width: 767.98px) {
    .dropdown-menu {
        border-radius: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        border: none;
        min-width: 200px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .dropdown-item i {
        width: 20px;
        text-align: center;
    }
}

/* ===== MOBILE PAGINATION ===== */
@media (max-width: 767.98px) {
    .pagination {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        margin: 0 0.125rem;
        border-radius: 0.375rem;
        border: 1px solid var(--gray-300);
    }
    
    .page-item.active .page-link {
        background-color: var(--orange-primary);
        border-color: var(--orange-primary);
    }
}

/* ===== MOBILE UTILITIES ===== */
@media (max-width: 767.98px) {
    /* Text sizing adjustments */
    .display-1 { font-size: 2.5rem; }
    .display-2 { font-size: 2rem; }
    .display-3 { font-size: 1.75rem; }
    .display-4 { font-size: 1.5rem; }
    
    /* Spacing adjustments */
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .my-5 { margin-top: 2rem !important; margin-bottom: 2rem !important; }
    
    /* Hide on mobile */
    .d-mobile-none {
        display: none !important;
    }
    
    /* Show only on mobile */
    .d-mobile-block {
        display: block !important;
    }
    
    .d-mobile-inline {
        display: inline !important;
    }
    
    .d-mobile-inline-block {
        display: inline-block !important;
    }
    
    .d-mobile-flex {
        display: flex !important;
    }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 767.98px) {
    /* Reduce animations on mobile for better performance */
    .fade-in-up {
        animation-duration: 0.3s;
    }
    
    /* Optimize shadows for mobile */
    .shadow-lg {
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Reduce border radius for sharper edges on small screens */
    .rounded-lg {
        border-radius: 0.375rem !important;
    }
}

/* ===== MOBILE SCROLLING ===== */
@media (max-width: 767.98px) {
    /* Smooth scrolling for mobile */
    html {
        scroll-behavior: smooth;
    }
    
    /* Better scrollbar for mobile webkit browsers */
    ::-webkit-scrollbar {
        width: 4px;
    }
    
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--orange-light);
        border-radius: 2px;
    }
}

/* ===== MOBILE INPUT ENHANCEMENTS ===== */
@media (max-width: 767.98px) {
    /* Prevent zoom on input focus for iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Better mobile keyboard handling */
    .form-control:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
        border-color: var(--orange-primary);
    }
}

/* ===== MOBILE ACCESSIBILITY ===== */
@media (max-width: 767.98px) {
    /* Larger focus indicators for mobile */
    .btn:focus,
    .form-control:focus,
    .nav-link:focus {
        outline: 2px solid var(--orange-primary);
        outline-offset: 2px;
    }
    
    /* Better contrast for mobile */
    .text-muted {
        color: var(--gray-600) !important;
    }
    
    /* Larger clickable areas */
    .clickable-row {
        cursor: pointer;
        transition: background-color 0.15s ease;
    }
    
    .clickable-row:hover {
        background-color: var(--orange-pale);
    }
}

/* ===== MOBILE LOADING STATES ===== */
@media (max-width: 767.98px) {
    .loading-spinner {
        display: inline-block;
        width: 1rem;
        height: 1rem;
        border: 2px solid var(--orange-light);
        border-top: 2px solid var(--orange-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .btn.loading {
        position: relative;
        color: transparent;
    }
    
    .btn.loading::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 1rem;
        height: 1rem;
        border: 2px solid currentColor;
        border-top: 2px solid transparent;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
}