/* ============================================
   FOODCOURT - Mobile-First Responsive CSS
   Uses CSS Variables for Dynamic Theming
   ============================================ */

/* ============================================
   CSS VARIABLES (Default values - overridden by header.php)
   ============================================ */
:root {
    --primary-color: #f97316;
    --secondary-color: #ea580c;
    --accent-color: #dc2626;
    --background-color: #f5f5f5;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --footer-bg: #1f2937;
    --gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --primary-light: #fff7ed;
    --primary-dark: #c2410c;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main, .main-content {
    flex: 1;
}

/* ============================================
   NAVBAR STYLES
   ============================================ */
.navbar {
    padding: 0.5rem 0;
    background: var(--header-bg);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    font-weight: 500;
    color: #4b5563;
    padding: 0.5rem 0.75rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 12px;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.dropdown-item:active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    background: var(--gradient);
    border-radius: 16px;
    padding: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

.hero-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-section p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ============================================
   CATEGORY PILLS
   ============================================ */
.category-pill {
    border-radius: 50px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border-color: #e5e7eb;
    color: #6b7280;
}

.category-pill:hover {
    background-color: #f3f4f6;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.category-pill.active, .category-pill.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ============================================
   MENU CARD STYLES
   ============================================ */
.menu-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: var(--card-bg);
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.menu-card .card-img-placeholder {
    height: 120px;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-color);
}

.menu-card .card-img-top {
    height: 120px;
    object-fit: cover;
}

.menu-card .card-body {
    padding: 0.75rem;
}

.menu-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-card .card-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.menu-card .card-footer {
    padding: 0.75rem;
    background: transparent;
}

.menu-card .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
}

/* ============================================
   CART OFFCANVAS
   ============================================ */
.offcanvas {
    width: 100% !important;
    max-width: 400px;
}

.offcanvas-header {
    background: var(--gradient);
    color: white;
}

.offcanvas-title {
    font-weight: 600;
}

.offcanvas-header .btn-close {
    filter: brightness(0) invert(1);
}

.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.cart-item-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-tenant {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-control .btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
}

.quantity-control .quantity {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ============================================
   TABLE SELECTION
   ============================================ */
.table-selection .btn-check:checked + label {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.table-selection label {
    transition: all 0.2s ease;
}

.table-selection label:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   PAYMENT METHOD
   ============================================ */
.payment-option .btn-check:checked + label {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--text-color);
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.btn-primary {
    background: var(--gradient);
    border: none;
    font-weight: 500;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
}

/* ============================================
   FORM STYLES
   ============================================ */
.form-control, .form-select {
    border-radius: 10px;
    border-color: #e5e7eb;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

/* ============================================
   CARD STYLES
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: var(--card-bg);
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid #f3f4f6;
    padding: 1rem;
    font-weight: 600;
}

/* ============================================
   SUCCESS PAGE
   ============================================ */
.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: white;
    font-size: 2.5rem;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: #f3f4f6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-box {
    width: 150px;
    height: 150px;
    background: repeating-linear-gradient(
        0deg,
        #d1d5db,
        #d1d5db 2px,
        transparent 2px,
        transparent 4px
    ),
    repeating-linear-gradient(
        90deg,
        #d1d5db,
        #d1d5db 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 8px;
}

/* ============================================
   BADGE STYLES
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
}

/* ============================================
   FOOTER STYLES
   ============================================ */
footer, .footer {
    background: var(--footer-bg);
    color: #9ca3af;
    padding: 1.5rem 0;
    margin-top: auto;
}

footer a {
    color: #d1d5db;
    text-decoration: none;
}

footer a:hover {
    color: var(--primary-color);
}

/* ============================================
   LINK & TEXT COLORS
   ============================================ */
a {
    color: var(--primary-color);
}

a:hover {
    color: var(--secondary-color);
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* ============================================
   FOCUS STATES
   ============================================ */
.btn:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.4);
}

/* ============================================
   ORDER TYPE BADGES
   ============================================ */
.order-type-dine_in {
    background-color: var(--primary-color);
    color: white;
}

.order-type-takeaway {
    background-color: #22c55e;
    color: white;
}

.order-type-delivery {
    background-color: #3b82f6;
    color: white;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */
@media (max-width: 576px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .hero-section {
        padding: 1rem;
        border-radius: 12px;
        margin-left: -12px;
        margin-right: -12px;
        margin-bottom: 0.75rem;
        width: calc(100% + 24px);
    }
    
    .hero-section h1 {
        font-size: 1.25rem;
    }
    
    .hero-section p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-section .badge {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
    
    .menu-card .card-img-placeholder,
    .menu-card .card-img-top {
        height: 100px;
    }
    
    .menu-card .card-title {
        font-size: 0.85rem;
    }
    
    .menu-card .card-text {
        display: none;
    }
    
    .menu-card .card-footer {
        padding: 0.5rem;
    }
    
    .menu-card .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .category-pill {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
    
    .form-control, .form-select {
        padding: 0.55rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.9rem;
    }
    
    .offcanvas {
        width: 100% !important;
    }
    
    /* Table grid for mobile */
    .table-selection .col-4 {
        padding: 0.25rem;
    }
    
    .table-selection .btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .table-selection .btn i {
        font-size: 1.2rem;
    }
    
    /* Checkout page */
    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .qr-placeholder {
        width: 150px;
        height: 150px;
    }
    
    .qr-box {
        width: 100px;
        height: 100px;
    }
    
    /* Alert */
    .alert {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
        border-radius: 0;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .hero-section h1 {
        font-size: 1.4rem;
    }
    
    .menu-card .card-img-placeholder,
    .menu-card .card-img-top {
        height: 130px;
    }
}

@media (min-width: 769px) {
    .hero-section {
        padding: 2rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .menu-card .card-img-placeholder,
    .menu-card .card-img-top {
        height: 160px;
    }
}

/* ============================================
   LOADING & ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   SAFE AREA (iOS)
   ============================================ */
@supports (padding: max(0px)) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    footer, .footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}

/* ============================================
   TOUCH IMPROVEMENTS
   ============================================ */
.btn, .nav-link, .dropdown-item {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* Remove tap highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Better scrolling on iOS */
.overflow-auto, .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.shadow-card {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.rounded-xl {
    border-radius: 16px;
}

.rounded-2xl {
    border-radius: 20px;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   ADMIN/TENANT PANEL STYLES
   ============================================ */
.sidebar {
    background: var(--card-bg);
    border-right: 1px solid #e5e7eb;
    min-height: calc(100vh - 60px);
}

.sidebar .nav-link {
    color: #6b7280;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
}

.sidebar .nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.stat-card {
    border-radius: 12px;
    background: var(--card-bg);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary-color);
}

.stat-icon.success {
    background: #dcfce7;
    color: #16a34a;
}

.stat-icon.warning {
    background: #fef3c7;
    color: #d97706;
}

.stat-icon.info {
    background: #dbeafe;
    color: #2563eb;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.status-processing, .status-preparing {
    background-color: #dbeafe;
    color: #2563eb;
}

.status-ready {
    background-color: #d1fae5;
    color: #059669;
}

.status-completed, .status-delivered {
    background-color: #dcfce7;
    color: #16a34a;
}

.status-cancelled {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #e5e7eb;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination .page-link:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

/* ============================================
   DATA TABLES
   ============================================ */
.table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    border-bottom: 1px solid #f3f4f6;
}

.table tbody tr:hover {
    background-color: var(--primary-light);
}

/* ============================================
   SWITCH TOGGLE
   ============================================ */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    background-color: var(--primary-color);
}

/* ============================================
   ALERT STYLES
   ============================================ */
.alert-primary {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.alert-primary .alert-link {
    color: var(--primary-dark);
}
