/* Restaurant Management System - Responsive Design */

/* Breakpoints:
   - Mobile: 320px - 768px
   - Tablet: 768px - 1024px
   - Desktop: 1024px+
*/

/* Mobile First Approach */

/* Extra Small Devices (phones, 320px and up) */
@media (max-width: 480px) {
    /* Layout Adjustments */
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1001;
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Header Adjustments */
    .main-header {
        padding: 10px 15px;
        position: sticky;
        top: 0;
        z-index: 999;
    }
    
    .header-left h2 {
        font-size: 18px;
        margin-left: 10px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .user-menu span {
        display: none;
    }
    
    /* Page Content */
    .page-content {
        padding: 15px;
    }
    
    /* Cards and Containers */
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table td,
    .table th {
        padding: 8px 5px;
        font-size: 14px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Modals */
    .modal-container {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
        padding: 20px;
    }
    
    .modal-header {
        margin-bottom: 15px;
    }
    
    .modal-footer {
        margin-top: 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Navigation */
    .nav-link {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    /* Statistics Cards */
    .stat-card {
        padding: 20px 15px;
        text-align: center;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        margin: 0 auto 10px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    /* Action Buttons */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Grid Layouts */
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* View Headers */
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .view-header h3 {
        text-align: center;
        font-size: 20px;
    }
    
    /* Quick Actions */
    .quick-actions .btn {
        padding: 15px;
        text-align: center;
    }
}

/* Small Devices (landscape phones, 480px and up) */
@media (min-width: 480px) and (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .page-content {
        padding: 20px;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        width: 90%;
        max-width: 500px;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .nav-link {
        padding: 10px 15px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .sidebar-logo {
        width: 30px;
        height: 30px;
    }
    
    .sidebar-header h3 {
        display: none;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table td,
    .table th {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .modal-container {
        width: 80%;
        max-width: 600px;
    }
}

/* Large Devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .dashboard-content {
        grid-template-columns: 2fr 1fr;
    }
    
    .form-row.three-columns {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row.four-columns {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .page-content {
        padding: 40px;
    }
    
    .dashboard-stats {
        gap: 25px;
    }
    
    .dashboard-content {
        gap: 40px;
    }
    
    .modal-container {
        max-width: 800px;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 600px) {
    .main-header {
        padding: 8px 20px;
    }
    
    .page-content {
        padding: 15px 20px;
    }
    
    .modal-container {
        max-height: 85vh;
    }
    
    .sidebar {
        width: 60px;
    }
    
    .sidebar .nav-link span,
    .sidebar-header h3 {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
    }
    
    .table-row {
        cursor: default;
    }
    
    .card:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn-icon {
        padding: 12px;
    }
    
    .modal-close {
        padding: 10px;
        font-size: 20px;
    }
    
    /* Remove hover effects */
    .stat-card:hover,
    .menu-item-card:hover,
    .customer-card:hover,
    .table-card:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar-logo,
    .user-avatar {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .main-header,
    .btn,
    .modal-overlay,
    .action-buttons {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .page-content {
        padding: 20px !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .table {
        font-size: 12px;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stat-card {
        background: white !important;
        color: black !important;
        border: 1px solid #000 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .sidebar {
        transition: none;
    }
    
    .modal-overlay {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    .form-control {
        border: 2px solid #000;
    }
    
    .stat-card {
        border: 2px solid #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a202c;
        color: #e2e8f0;
    }
    
    .sidebar {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .main-header {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .form-control {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .form-control:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    }
    
    .table {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .table th {
        background: #4a5568;
        border-color: #718096;
    }
    
    .table td {
        border-color: #4a5568;
    }
    
    .modal-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .btn-secondary {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
}

/* Container Queries (when supported) */
@supports (container-type: inline-size) {
    .dashboard-container {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .dashboard-stats {
            grid-template-columns: 1fr;
        }
    }
    
    @container (min-width: 800px) {
        .dashboard-stats {
            grid-template-columns: repeat(4, 1fr);
        }
    }
}

/* Utility Classes for Responsive Design */
.show-mobile {
    display: none;
}

.hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block;
    }
    
    .hide-mobile {
        display: none;
    }
    
    .mobile-full-width {
        width: 100%;
    }
    
    .mobile-text-center {
        text-align: center;
    }
    
    .mobile-stack {
        flex-direction: column;
    }
    
    .mobile-stack > * {
        width: 100%;
    }
}

.show-tablet {
    display: none;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .show-tablet {
        display: block;
    }
    
    .hide-tablet {
        display: none;
    }
}

.show-desktop {
    display: none;
}

@media (min-width: 1024px) {
    .show-desktop {
        display: block;
    }
    
    .hide-desktop {
        display: none;
    }
}

/* Responsive Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    h3 {
        font-size: 18px;
    }
    
    h4 {
        font-size: 16px;
    }
    
    h5 {
        font-size: 14px;
    }
    
    h6 {
        font-size: 12px;
    }
}

/* Responsive Spacing */
@media (max-width: 768px) {
    .p-4 {
        padding: 15px;
    }
    
    .m-4 {
        margin: 15px;
    }
    
    .gap-4 {
        gap: 15px;
    }
}

/* Focus Management for Mobile */
@media (max-width: 768px) {
    .form-control:focus {
        transform: scale(1.02);
        z-index: 10;
        position: relative;
    }
    
    .btn:focus {
        transform: scale(1.05);
        z-index: 10;
        position: relative;
    }
}