/**
 * Mobile-Responsive Framework for Garage Management System
 * Optimized for phones, tablets, and desktop
 */

/* ===== MULTI-LANGUAGE FONT SUPPORT ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@300;400;500;600;700&display=swap');

/* Language-specific font families */
html[lang="bn"], html[lang="bn"] * {
    font-family: 'Noto Sans Bengali', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

html[lang="ml"], html[lang="ml"] * {
    font-family: 'Noto Sans Malayalam', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* ===== MOBILE NAVIGATION ===== */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

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

.mobile-menu-overlay.active {
    display: block;
}

.mobile-nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-nav-menu.active {
    right: 0;
}

.mobile-nav-header {
    background: linear-gradient(135deg, #FF6600 0%, #FF8C32 100%);
    color: white;
    padding: 20px;
    font-size: 1.2em;
    font-weight: 700;
}

.mobile-nav-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.mobile-nav-items {
    padding: 0;
    margin: 0;
    list-style: none;
}

.mobile-nav-items li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-nav-items a,
.mobile-nav-items button {
    display: block;
    padding: 18px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-nav-items a:hover,
.mobile-nav-items button:hover {
    background: #f9f9f9;
}

.mobile-nav-items .icon {
    margin-right: 12px;
    font-size: 20px;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Large Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
}

/* Tablet & Small Desktop */
@media (max-width: 1024px) {
    .container {
        padding: 20px 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Tablet Portrait */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }
    
    .desktop-nav {
        display: none !important;
    }
    
    .header {
        padding: 15px 20px !important;
    }
    
    .logo {
        font-size: 1.3em !important;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }
    
    .page-header h1 {
        font-size: 1.5em !important;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .card {
        padding: 20px 15px !important;
        height: auto !important;
        min-height: 140px !important;
    }
    
    .card h3 {
        font-size: 0.75em !important;
        margin-bottom: 8px !important;
    }
    
    .stat-number {
        font-size: 1.8em !important;
        margin-bottom: 5px !important;
    }
    
    .stat-label {
        font-size: 0.75em !important;
    }
    
    .stat-card {
        padding: 15px !important;
    }
    
    .stat-card h3 {
        font-size: 0.7em !important;
    }
    
    .stat-card .value {
        font-size: 1.6em !important;
    }
    
    .filters {
        flex-direction: row !important;
        gap: 6px !important;
        padding: 10px !important;
        flex-wrap: nowrap !important;
    }
    
    .filter-group {
        flex: 1 !important;
        width: auto !important;
        min-width: 0 !important;
    }
    
    .filter-group label {
        display: none !important;
    }
    
    .filter-group select,
    .filter-group input {
        padding: 8px 4px !important;
        font-size: 0.75em !important;
    }
    
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Professional Action Buttons for Tablet */
    .quick-actions {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }
    
    .action-btn {
        padding: 20px 15px !important;
        font-size: 0.95em !important;
        flex-direction: column !important;
        gap: 10px !important;
        min-height: 110px !important;
        border-radius: 14px !important;
        box-shadow: 0 4px 15px rgba(255, 107, 53, 0.25) !important;
    }
    
    .action-btn .action-icon {
        font-size: 2.2em !important;
    }
    
    .action-btn:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35) !important;
    }
}

/* Mobile Landscape & Small Tablet */
@media (max-width: 640px) {
    .container {
        padding: 15px 10px !important;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .btn {
        width: 100%;
        padding: 14px 20px !important;
    }
    
    .page-header {
        margin-bottom: 20px !important;
    }
    
    /* Action buttons for small tablets */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .action-btn {
        padding: 18px 15px !important;
        font-size: 0.95em !important;
        min-height: 100px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .action-btn .action-icon {
        font-size: 2em !important;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .header {
        padding: 12px 15px !important;
    }
    
    .logo {
        font-size: 1.1em !important;
    }
    
    .page-header h1 {
        font-size: 1.3em !important;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .card {
        padding: 15px 12px !important;
        min-height: 120px !important;
        border-radius: 12px !important;
    }
    
    .card h3 {
        font-size: 0.65em !important;
        margin-bottom: 6px !important;
        letter-spacing: 0.3px !important;
    }
    
    .stat-number {
        font-size: 1.5em !important;
        margin-bottom: 4px !important;
    }
    
    .stat-label {
        font-size: 0.7em !important;
        line-height: 1.1 !important;
    }
    
    .card .value {
        font-size: 1.3em !important;
    }
    
    .stat-card {
        padding: 12px !important;
    }
    
    .stat-card h3 {
        font-size: 0.65em !important;
    }
    
    .stat-card .value {
        font-size: 1.3em !important;
    }
    
    .btn {
        font-size: 14px !important;
        padding: 12px 18px !important;
    }
    
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .modal-content {
        width: 95% !important;
        margin: 10px !important;
        max-height: 90vh !important;
        overflow-y: auto;
    }
    
    /* Professional Action Buttons for Mobile */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-top: 25px !important;
    }
    
    .action-btn {
        padding: 16px 12px !important;
        font-size: 0.9em !important;
        border-radius: 12px !important;
        flex-direction: column !important;
        gap: 8px !important;
        min-height: 90px !important;
        box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25) !important;
        position: relative;
        overflow: hidden;
    }
    
    .action-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
        pointer-events: none;
    }
    
    .action-btn .action-icon {
        font-size: 1.8em !important;
        margin-bottom: 4px;
    }
    
    .action-btn span:not(.action-icon) {
        font-size: 0.85em !important;
        font-weight: 600 !important;
        text-align: center;
        line-height: 1.2;
    }
    
    .action-btn:active {
        transform: scale(0.95) !important;
        box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3) !important;
    }
}

/* ===== RESPONSIVE TABLES ===== */

/* Hide table on mobile, show card view */
@media (max-width: 768px) {
    .data-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Option 1: Horizontal scroll for complex tables */
    .data-table.scroll-mobile {
        min-width: 600px;
    }
    
    /* Option 2: Card view for simple tables */
    .data-table.card-mobile {
        display: none;
    }
    
    .mobile-card-view {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-card-view {
        display: none;
    }
}

/* Mobile Card Styles */
.mobile-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #FF6600;
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-card-title {
    font-weight: 700;
    font-size: 1.1em;
    color: #333;
}

.mobile-card-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.mobile-card-body {
    display: grid;
    gap: 10px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.mobile-card-label {
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

.mobile-card-value {
    color: #333;
    font-weight: 600;
    text-align: right;
}

.mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.mobile-card-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

/* ===== TOUCH-FRIENDLY ELEMENTS ===== */

/* Minimum touch target size: 44x44px (Apple HIG) */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Better tap feedback */
.btn:active,
button:active,
a:active {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Prevent text selection on buttons */
.btn, button {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ===== MOBILE FORM OPTIMIZATION ===== */

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
        display: block;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        border-radius: 8px;
        border: 2px solid #e0e0e0;
        width: 100%;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-color: #FF6600;
        outline: none;
    }
    
    textarea {
        min-height: 100px;
        resize: vertical;
    }
}

/* ===== MOBILE UTILITIES ===== */

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

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* Text sizes */
@media (max-width: 480px) {
    .text-lg-mobile {
        font-size: 1.2em !important;
    }
    
    .text-md-mobile {
        font-size: 1em !important;
    }
    
    .text-sm-mobile {
        font-size: 0.85em !important;
    }
}

/* Spacing utilities for mobile */
@media (max-width: 768px) {
    .mb-mobile-sm { margin-bottom: 8px !important; }
    .mb-mobile-md { margin-bottom: 16px !important; }
    .mb-mobile-lg { margin-bottom: 24px !important; }
    
    .mt-mobile-sm { margin-top: 8px !important; }
    .mt-mobile-md { margin-top: 16px !important; }
    .mt-mobile-lg { margin-top: 24px !important; }
    
    .p-mobile-sm { padding: 8px !important; }
    .p-mobile-md { padding: 16px !important; }
    .p-mobile-lg { padding: 24px !important; }
}

/* ===== MOBILE NAVIGATION TABS ===== */

@media (max-width: 768px) {
    .nav-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .nav-tab {
        white-space: nowrap;
        min-width: auto;
        flex-shrink: 0;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
}

/* ===== ACCESSIBILITY ===== */

/* Ensure sufficient color contrast */
.text-light {
    color: #666;
}

.text-dark {
    color: #333;
}

/* Focus states for keyboard navigation */
*:focus {
    outline: 2px solid #FF6600;
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid #FF6600;
    outline-offset: 2px;
}

/* ===== LOADING STATES ===== */

@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}

/* ===== RESPONSIVE IMAGES ===== */

img {
    max-width: 100%;
    height: auto;
}

/* ===== SAFE AREA FOR NOTCHED PHONES ===== */

@supports (padding: max(0px)) {
    .header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .mobile-nav-toggle,
    .mobile-menu-overlay,
    .mobile-nav-menu,
    .header-actions,
    .no-print {
        display: none !important;
    }
}
