/**
 * Responsive Utilities - Shakhsiyatka
 * Enhanced Mobile-First Responsive Design
 */

/* ===== BASE RESPONSIVE UTILITIES ===== */

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Responsive Grid */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem;
}

.col {
    flex: 1;
    padding: 0.5rem;
    min-width: 0;
}

/* ===== MOBILE FIRST BREAKPOINTS ===== */

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    /* Hide on mobile */
    .d-none-mobile,
    .hide-mobile {
        display: none !important;
    }
    
    /* Full width on mobile */
    .col, .col-12, [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Stack buttons on mobile */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
    
    /* Cards full width */
    .card {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        border-radius: 0;
    }
    
    /* Tables scroll on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Floating buttons smaller on mobile */
    .floating-btns {
        bottom: 1rem;
        right: 1rem;
    }
    
    [dir="rtl"] .floating-btns {
        right: 1rem;
        left: auto;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    /* Header adjustments */
    .header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
        order: 1;
        flex: 0 0 100%;
        text-align: center;
    }
    
    /* Navigation */
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Modal full screen */
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-sm-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .d-none-tablet {
        display: none !important;
    }
    
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
    
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    /* Stats grid 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        padding: 0 2rem;
    }
    
    .col-lg-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
    
    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    /* Stats grid 3-4 columns */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Sidebar layout */
    .with-sidebar {
        display: grid;
        grid-template-columns: 260px 1fr;
        gap: 2rem;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ===== UTILITY CLASSES ===== */

/* Flexbox */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Text */
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }

/* Margins */
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* Width */
.w-100 { width: 100%; }
.w-auto { width: auto; }

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn, button, a, input, select, textarea {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover,
    a:hover {
        transform: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print,
    .floating-btns,
    .header,
    .sidebar,
    .nav-links {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== DARK/LIGHT THEME RESPONSIVE ===== */
[data-theme="light"] body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
}

[data-theme="light"] .btn-outline {
    border-color: #1e293b;
    color: #1e293b;
}
