/* Responsive Design for All Device Sizes */
/* Mobile First Approach */

/* ============================================
   GLOBAL RESPONSIVE UTILITIES
   ============================================ */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

/* Show on mobile */
.show-mobile {
    display: none;
}

/* ============================================
   MAIN NAVIGATION RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .nav-container {
        flex-wrap: wrap !important;
    }
    
    .nav-center {
        order: 3;
        width: 100%;
        padding: 10px 0 0 0 !important;
        text-align: center !important;
    }
    
    .nav-right {
        flex-wrap: wrap;
        gap: 10px !important;
    }
}

@media (max-width: 768px) {
    .main-nav {
        padding: 10px 15px !important;
    }
    
    .nav-container {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .nav-left {
        width: 100%;
    }
    
    .brand-title {
        font-size: 22px !important;
    }
    
    .nav-info {
        flex-wrap: wrap;
        gap: 10px !important;
        margin-top: 10px;
    }
    
    .nav-center {
        order: 3;
        width: 100%;
        padding: 10px 0 !important;
        text-align: left !important;
    }
    
    .tagline {
        font-size: 12px !important;
    }
    
    .nav-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
    
    .nav-right .btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    .background-logo {
        font-size: 200px !important;
        left: 20px !important;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 18px !important;
    }
    
    .nav-info {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .phone-number {
        font-size: 12px !important;
    }
    
    .nav-right {
        flex-direction: column;
        gap: 8px !important;
    }
    
    .nav-right .btn {
        width: 100%;
    }
}

/* ============================================
   ADMIN PAGES RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .admin-nav {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
    }
    
    .admin-nav a {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .admin-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table table {
        min-width: 600px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .sell-container {
        grid-template-columns: 1fr !important;
    }
    
    .menu-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
    
    .cart-section {
        position: static !important;
        max-height: none !important;
    }
}

@media (max-width: 480px) {
    .admin-nav a {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .stat-card {
        padding: 15px !important;
    }
    
    .stat-card .stat-value {
        font-size: 24px !important;
    }
    
    .menu-item-card {
        padding: 10px !important;
    }
    
    .item-image img {
        height: 100px !important;
    }
}

/* ============================================
   FORMS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        margin-bottom: 10px;
    }
}

/* ============================================
   MODAL RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        margin: 10% auto !important;
        padding: 20px !important;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content h2 {
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98% !important;
        margin: 5% auto !important;
        padding: 15px !important;
    }
    
    .close {
        font-size: 24px !important;
    }
}

/* ============================================
   MENU/CART PAGES RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .menu-grid,
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .menu-grid,
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 15px !important;
    }
    
    .menu-item-card,
    .item-card {
        padding: 15px !important;
    }
    
    .cart-summary {
        position: static !important;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .menu-grid,
    .items-grid {
        grid-template-columns: 1fr !important;
    }
    
    .menu-item-card,
    .item-card {
        padding: 12px !important;
    }
}

/* ============================================
   CHARTS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .chart-card {
        padding: 15px !important;
    }
    
    .chart-card canvas {
        max-height: 250px !important;
    }
    
    .admin-analytics > .container > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   TABLES RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Make tables scrollable on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
    
    /* Stack table cells on very small screens */
    @media (max-width: 480px) {
        .table-responsive table,
        .table-responsive thead,
        .table-responsive tbody,
        .table-responsive th,
        .table-responsive td,
        .table-responsive tr {
            display: block;
        }
        
        .table-responsive thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        .table-responsive tr {
            border: 1px solid #ccc;
            margin-bottom: 10px;
            padding: 10px;
        }
        
        .table-responsive td {
            border: none;
            position: relative;
            padding-left: 50% !important;
            text-align: left;
        }
        
        .table-responsive td:before {
            content: attr(data-label);
            position: absolute;
            left: 6px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
            font-weight: 600;
        }
    }
}

/* ============================================
   CONTAINER RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .container {
        max-width: 100% !important;
        padding: 15px !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px !important;
    }
    
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 18px !important;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Show/Hide based on screen size */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .hide-tablet {
        display: block !important;
    }
    
    .show-tablet {
        display: none !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
    
    .show-tablet {
        display: block !important;
    }
}

/* ============================================
   TOUCH FRIENDLY ELEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Larger touch targets */
    button,
    .btn,
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Prevent text size adjustment on iOS */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ============================================
   CART & CHECKOUT RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .cart-page,
    .checkout-page {
        padding: 15px !important;
    }
    
    .cart-items-list {
        padding: 0 !important;
    }
    
    .cart-item {
        flex-direction: column !important;
        padding: 15px !important;
    }
    
    .cart-item-image {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
    }
    
    .cart-item-details {
        width: 100% !important;
    }
    
    .cart-summary {
        position: static !important;
        margin-top: 20px;
        padding: 20px !important;
    }
    
    .checkout-grid {
        grid-template-columns: 1fr !important;
    }
    
    .checkout-form,
    .checkout-summary {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .cart-item {
        padding: 10px !important;
    }
    
    .cart-item-quantity {
        flex-wrap: wrap;
    }
    
    .checkout-form {
        padding: 15px !important;
    }
}

/* ============================================
   CATEGORY FILTERS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .category-buttons {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    
    .category-btn {
        padding: 8px 15px !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .category-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 5px;
    }
    
    .category-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ============================================
   ORDERS PAGE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .orders-list {
        padding: 10px !important;
    }
    
    .order-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .order-items {
        font-size: 14px !important;
    }
}

/* ============================================
   PROFILE PAGE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .profile-container {
        flex-direction: column !important;
    }
    
    .profile-sidebar,
    .profile-content {
        width: 100% !important;
    }
}

/* ============================================
   FILTERS & SEARCH RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .admin-filters form {
        flex-direction: column !important;
    }
    
    .admin-filters .form-group {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    .menu-search {
        width: 100%;
    }
    
    .menu-search input {
        width: 100% !important;
    }
}

/* ============================================
   STATS CARDS RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   BUTTON GROUPS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* ============================================
   IMAGES RESPONSIVE
   ============================================ */

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .item-image-small,
    .item-logo-small {
        max-width: 50px !important;
        max-height: 50px !important;
    }
}

/* ============================================
   TEXT RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 24px !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 20px !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 18px !important;
        line-height: 1.3 !important;
    }
    
    p {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
}

/* ============================================
   SPACING RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    section {
        padding: 30px 15px !important;
    }
    
    .section-title {
        margin-bottom: 20px !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .main-nav,
    .admin-nav,
    .btn,
    button,
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .background-logo {
        display: none !important;
    }
}

