/**
 * Mobile Responsive Styles for Workshop Management System
 * Optimized for small screens (phones and tablets)
 */

/* ==================== Global Mobile Styles ==================== */
@media (max-width: 768px) {
    /* Body and Container */
    body {
        font-size: 14px;
        overflow-x: hidden;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Headers */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    h4, h5, h6 {
        font-size: 1rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .card-header {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .btn-sm {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
    
    /* Forms */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .input-group {
        flex-wrap: nowrap;
    }
    
    /* Tables - Responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 15px;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 100%;
    }
    
    table thead th {
        padding: 8px 5px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    table tbody td {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
    
    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Stack columns vertically */
    .row > [class*='col-'] {
        margin-bottom: 10px;
    }
    
    /* Navigation */
    .navbar {
        padding: 8px 10px;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        position: relative;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Alerts */
    .alert {
        padding: 10px 15px;
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    /* Badges */
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    /* Pagination */
    .pagination {
        font-size: 0.85rem;
    }
    
    .page-link {
        padding: 5px 10px;
    }
}

/* ==================== Extra Small Screens (< 576px) ==================== */
@media (max-width: 576px) {
    body {
        font-size: 13px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .card-header h3,
    .card-header h4 {
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    table thead th,
    table tbody td {
        padding: 6px 3px;
        font-size: 0.75rem;
    }
    
    /* Stack buttons vertically */
    .btn-group-vertical-mobile {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-vertical-mobile .btn {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* ==================== Specific Component Styles ==================== */

/* Dashboard Cards */
@media (max-width: 768px) {
    .dashboard-card {
        margin-bottom: 15px;
    }
    
    .dashboard-card .card-body {
        padding: 15px;
        text-align: center;
    }
    
    .dashboard-card h4 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .dashboard-card small {
        font-size: 0.85rem;
    }
}

/* Statement/Report Tables */
@media (max-width: 768px) {
    .statement-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .statement-table {
        min-width: 600px;
    }
    
    /* Collapsible rows for details */
    .details-row {
        display: block;
        width: 100%;
    }
    
    .details-row td {
        display: block;
        width: 100%;
        padding: 10px;
    }
}

/* Vendor/Customer Cards */
@media (max-width: 768px) {
    .vendor-card,
    .customer-card {
        margin-bottom: 15px;
    }
    
    .vendor-card .card-body,
    .customer-card .card-body {
        padding: 12px;
    }
    
    .vendor-info,
    .customer-info {
        font-size: 0.85rem;
    }
}

/* Forms - Better Mobile Layout */
@media (max-width: 768px) {
    .form-row {
        display: flex;
        flex-direction: column;
    }
    
    .form-row > div {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Date pickers */
    input[type="date"],
    input[type="datetime-local"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Select dropdowns */
    select.form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Action Buttons - Mobile Friendly */
@media (max-width: 768px) {
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: flex-start;
    }
    
    .action-buttons .btn {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    /* Fixed bottom action bar for forms */
    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 10px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        gap: 10px;
    }
    
    .mobile-action-bar .btn {
        flex: 1;
    }
}

/* Search and Filter Forms */
@media (max-width: 768px) {
    .search-form,
    .filter-form {
        margin-bottom: 15px;
    }
    
    .search-form .row,
    .filter-form .row {
        display: flex;
        flex-direction: column;
    }
    
    .search-form .col,
    .filter-form .col {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .search-form .btn,
    .filter-form .btn {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Print Styles - Hide on mobile */
@media (max-width: 768px) {
    .print-only {
        display: none !important;
    }
}

/* Touch-friendly elements */
@media (max-width: 768px) {
    /* Larger touch targets */
    a, button, .btn, .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Checkbox and radio buttons */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Toggle switches */
    .form-check-input {
        width: 2.5rem;
        height: 1.5rem;
    }
}

/* Loading and Empty States */
@media (max-width: 768px) {
    .empty-state {
        padding: 30px 15px;
        text-align: center;
    }
    
    .empty-state i {
        font-size: 3rem;
        margin-bottom: 15px;
        opacity: 0.3;
    }
    
    .empty-state p {
        font-size: 0.9rem;
        color: #666;
    }
}

/* Utility Classes */
@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-mb-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mobile-mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* Landscape Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Dark Mode Support (if needed) */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .card {
        background-color: #1e1e1e;
        color: #fff;
    }
    
    .table {
        color: #fff;
    }
    
    .form-control,
    .form-select {
        background-color: #2d2d2d;
        color: #fff;
        border-color: #444;
    }
}
