/**
 * Restaurant Management System - Complete CSS
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Primary Colors changed to Professional Blue */
    --primary-color: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #3385FF;
    
    --secondary-color: #4A5568;
    --accent-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    
    --bg-color: #F7FAFC;
    --text-primary: #1A202C;
    --text-secondary: #718096;
    --border-color: #E2E8F0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 1.5rem; --spacing-xl: 2rem;
    --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-full: 9999px;
    
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-size-xs: 0.75rem; --font-size-sm: 0.875rem; --font-size-base: 1rem; --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem; --font-size-2xl: 1.5rem; --font-size-3xl: 1.875rem;
    
    --transition-fast: 150ms ease; --transition-base: 200ms ease;
}

body { font-family: var(--font-primary); font-size: var(--font-size-base); color: var(--text-primary); background-color: var(--bg-color); }

.rm-customer-wrapper { 
    min-height: 100vh; 
    background: var(--bg-color); 
    padding-bottom: 0 !important; 
    display: flex;
    flex-direction: column; 
}

/* ============================================
   UPDATED CUSTOMER HEADER (Full Width & Left Stacked)
   ============================================ */
.rm-header { 
    color: white; 
    padding: 60px 20px 40px 20px !important; 
    position: relative; 
    z-index: 100; 
    box-shadow: var(--shadow-lg);
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    box-sizing: border-box;
    display: flex;
    justify-content: center; 
    align-items: center; 
}

.rm-header-content-left {
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
    gap: 15px; 
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto;
}

.rm-logo-container { display: flex; align-items: center; gap: var(--spacing-md); }
.rm-logo { width: 50px; height: 50px; border-radius: var(--radius-full); object-fit: cover; border: 3px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.rm-restaurant-name { 
    font-size: 38px; 
    font-weight: 700;
    font-family: 'Playfair Display', serif !important; 
    color: white !important; 
    text-shadow: 2px 2px 5px rgba(0,0,0,0.7); 
    margin: 0 !important; 
}

.rm-table-info { 
    display: inline-flex; 
    align-items: center; 
    gap: var(--spacing-sm); 
    background: rgba(255,255,255,0.2); 
    padding: var(--spacing-sm) var(--spacing-md); 
    border-radius: var(--radius-lg); 
    backdrop-filter: blur(8px); 
    border: 1px solid rgba(255,255,255,0.3);
    margin: 0 !important; 
}
.rm-table-label { font-size: var(--font-size-base); font-weight: 600; color: white !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }
.rm-table-number { font-size: var(--font-size-xl); font-weight: 700; color: white !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }

/* ============================================
   CATEGORY NAVIGATION & SEARCH
   ============================================ */
.rm-category-nav-wrapper { background: white; box-shadow: var(--shadow-sm); position: sticky; top: 100px; z-index: 99; overflow: hidden; }
.rm-category-nav { display: flex; gap: var(--spacing-sm); padding: var(--spacing-md); overflow-x: auto; scrollbar-width: none; }
.rm-category-nav::-webkit-scrollbar { display: none; }
.rm-category-btn { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: var(--spacing-sm) var(--spacing-md); background: var(--bg-color); border: 2px solid transparent; border-radius: var(--radius-lg); cursor: pointer; min-width: 80px; }
.rm-category-btn.active { background: var(--primary-color); color: white; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.rm-cat-icon { font-size: var(--font-size-2xl); }
.rm-cat-name { font-size: var(--font-size-xs); font-weight: 600; white-space: nowrap; }

/* 🌟 FIXED: Search Container Full Width */
.rm-search-container { 
    padding: var(--spacing-md); 
    max-width: 1200px; 
    margin: 0 auto; 
    width: 100%; /* Fixes the squished search bar issue */
}
.rm-search-input { width: 100%; padding: var(--spacing-md); border: 2px solid var(--border-color); border-radius: var(--radius-lg); font-size: var(--font-size-base); }
.rm-search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0,102,255,0.1); }

/* ============================================
   MENU GRID & CARDS
   ============================================ */
/* 🌟 FIXED: Reduced gap before footer */
.rm-menu-container { 
    padding: 0 var(--spacing-md) 60px var(--spacing-md) !important; /* Reduced from 120px to 60px */
    max-width: 1200px; 
    margin: 0 auto; 
    width: 100%;
    flex-grow: 1; 
}
.rm-section-title { font-size: var(--font-size-2xl); font-weight: 700; margin-bottom: var(--spacing-lg); }

.rm-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.rm-menu-item {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.rm-item-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; 
    background: var(--bg-color);
}
.rm-item-image {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
}
.rm-item-details {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}
.rm-item-name { font-size: var(--font-size-sm); font-weight: 700; margin-bottom: 4px; line-height: 1.2; }
.rm-item-description { 
    font-size: var(--font-size-xs); color: var(--text-secondary); margin-bottom: 12px; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rm-item-footer {
    display: flex;
    flex-direction: row; 
    justify-content: space-between;
    align-items: center;
    gap: 8px; 
}
.rm-item-price { font-size: var(--font-size-base); font-weight: 700; color: var(--primary-color); }

.rm-add-to-cart-btn {
    background: var(--primary-color);
    color: white; border: none; padding: 6px 14px;
    border-radius: 20px; font-weight: 600; font-size: 13px;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}

/* ============================================
   CART FLOATING BTN & MODAL
   ============================================ */
.rm-cart-float-btn {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 450px; height: 60px;
    background: var(--primary-color); color: white;
    border: none; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--spacing-lg); cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 102, 255, 0.4);
    z-index: 1000;
}
.rm-cart-float-left { display: flex; align-items: center; gap: var(--spacing-sm); font-weight: 600; font-size: var(--font-size-base); }
.rm-cart-icon { font-size: var(--font-size-xl); }
.rm-cart-float-right { font-weight: 700; font-size: var(--font-size-base); }

/* Cart Modal */
.rm-cart-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 2000; display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity var(--transition-base); }
.rm-cart-modal.active { opacity: 1; pointer-events: all; }
.rm-cart-content { background: white; width: 100%; max-height: 80vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform var(--transition-slow); }
.rm-cart-modal.active .rm-cart-content { transform: translateY(0); }
.rm-cart-header { display: flex; justify-content: space-between; padding: var(--spacing-lg); border-bottom: 1px solid var(--border-color); }
.rm-cart-close { background: none; border: none; font-size: var(--font-size-3xl); cursor: pointer; color: var(--text-secondary); }
.rm-cart-items { flex: 1; overflow-y: auto; padding: var(--spacing-md); }
.rm-cart-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--spacing-sm); align-items: center; padding: var(--spacing-md); background: var(--bg-color); border-radius: var(--radius-lg); margin-bottom: var(--spacing-sm); }
.rm-qty-btn { 
    width: 32px; height: 32px; background: white; 
    border: 1px solid var(--border-color); border-radius: var(--radius-md); 
    cursor: pointer; font-weight: 700; 
    display: flex; align-items: center; justify-content: center; 
    padding: 0;
    line-height: 1;
    font-size: 18px;
}
.rm-remove-item { 
    background: var(--danger-color); color: white; border: none; 
    width: 32px; height: 32px; border-radius: var(--radius-md); 
    cursor: pointer; 
    display: flex; align-items: center; justify-content: center; 
    padding: 0;
    line-height: 1;
    font-size: 18px;
}
.rm-cart-footer { padding: var(--spacing-lg); border-top: 1px solid var(--border-color); background: white; }
.rm-cart-total { display: flex; justify-content: space-between; margin-bottom: var(--spacing-md); font-size: var(--font-size-lg); font-weight: 700;}
.rm-total-amount { color: var(--primary-color); font-size: var(--font-size-2xl); }
.rm-place-order-btn { width: 100%; padding: var(--spacing-md); background: var(--primary-color); color: white; border: none; border-radius: var(--radius-lg); font-size: var(--font-size-lg); font-weight: 700; cursor: pointer; }

/* ============================================
   SUCCESS MODAL
   ============================================ */
.rm-success-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 3000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity var(--transition-base); padding: var(--spacing-lg); }
.rm-success-modal.active { opacity: 1; pointer-events: all; }
.rm-success-content { background: white; padding: var(--spacing-xl); border-radius: var(--radius-xl); text-align: center; max-width: 450px; width: 100%; max-height: 90vh; overflow-y: auto; transform: scale(0.9); }
.rm-success-modal.active .rm-success-content { transform: scale(1); }
.rm-success-icon { width: 70px; height: 70px; background: var(--accent-color); color: white; font-size: var(--font-size-2xl); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--spacing-md); }
.rm-success-msg { font-size: var(--font-size-sm); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--spacing-md); }
.rm-order-id { margin-bottom: var(--spacing-lg); padding: var(--spacing-sm); background: var(--bg-color); border-radius: var(--radius-md); font-weight: 700; }

.rm-success-actions { display: flex; flex-direction: column; gap: 10px; }
.rm-action-link { display: block; width: 100%; padding: 12px; border-radius: var(--radius-md); font-weight: 700; text-decoration: none; font-size: 15px; transition: all 0.2s; }
.rm-btn-info { background: #EBF4FF; color: var(--primary-color); border: 1px solid var(--primary-color); }
.rm-btn-game { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.rm-btn-home { background: var(--primary-color); color: white; }

/* Spinners & Utilities */
.rm-spinner { width: 40px; height: 40px; border: 4px solid var(--border-color); border-top-color: var(--primary-color); border-radius: var(--radius-full); animation: spin 1s linear infinite; margin: 0 auto var(--spacing-md); }
@keyframes spin { to { transform: rotate(360deg); } }
.rm-menu-loading, .rm-empty { text-align: center; padding: var(--spacing-xl); color: var(--text-secondary); grid-column: 1 / -1; }

/* ============================================
   DESKTOP VIEW (Frontend)
   ============================================ */
@media (min-width: 1024px) {
    .rm-menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    
    /* 🌟 FIXED: Added min-height & max-height to ensure at least 2-3 items are visible */
    .rm-cart-content { 
        max-width: 500px; 
        margin: 0 auto; 
        border-radius: var(--radius-xl); 
        min-height: 550px;  /* Forces the modal to be tall enough */
        max-height: 90vh;   /* Uses 90% of screen height */
        display: flex;
        flex-direction: column;
    }
    
    .rm-cart-modal { align-items: center; }
}
/* ============================================
   MODULE 3: DASHBOARD STYLES (PROFESSIONAL & RESPONSIVE)
   ============================================ */

.rm-dashboard-wrapper { min-height: 100vh; background: #F3F4F6; padding: 30px; font-family: -apple-system, sans-serif; }
.rm-dash-header { background: white; padding: 20px 30px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }
.rm-dash-header h1 { font-size: 24px; color: #1F2937; margin:0; }
.rm-dash-tabs { display: flex; gap: 10px; }
.rm-dash-tab { padding: 10px 20px; background: #E5E7EB; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; color: #4B5563; transition: 0.2s; }
.rm-dash-tab.active { background: var(--primary-color); color: white; }

/* Grid & Cards */
.rm-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.rm-dash-card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 20px; width: 100%; }
.rm-card-title { font-size: 18px; color: #111827; margin-bottom: 20px; border-bottom: 2px solid #F3F4F6; padding-bottom: 10px; }

/* Responsive Tables */
.rm-table-responsive { 
    width: 100%; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    display: block; 
}

.rm-action-container {
    width: 100%;
    max-width: 250px;
    text-align: right;
}

@media (max-width: 768px) {
    .rm-action-container {
        max-width: 100%;
        margin-top: 15px;
    }
}
.rm-professional-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 500px; }
.rm-professional-table th { background: #F9FAFB; padding: 12px 15px; color: #6B7280; font-size: 13px; text-transform: uppercase; border-bottom: 1px solid #E5E7EB; white-space: nowrap; }
.rm-professional-table td { padding: 15px; border-bottom: 1px solid #E5E7EB; color: #1F2937; vertical-align: middle; }
.rm-professional-table tr:hover td { background: #F9FAFB; }
.rm-badge-status { padding: 4px 10px; background: #D1FAE5; color: #065F46; border-radius: 20px; font-size: 12px; font-weight: bold; white-space: nowrap; }

/* iOS Style Toggle Switch */
.rm-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.rm-switch input { opacity: 0; width: 0; height: 0; }
.rm-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.rm-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .rm-slider { background-color: var(--primary-color); }
input:checked + .rm-slider:before { transform: translateX(20px); }

/* Live Order Cards */
.rm-professional-card { background: white; border: 1px solid #E5E7EB; border-radius: 10px; padding: 20px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.rm-card-top { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #F3F4F6; padding-bottom: 10px; flex-wrap: wrap; gap: 10px; }
.rm-table-badge { background: #FEF2F2; color: #DC2626; padding: 5px 12px; border-radius: 6px; font-weight: bold; font-size: 14px; border: 1px solid #FCA5A5; }
.rm-card-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #F3F4F6; padding-top: 15px; margin-top: 10px; flex-wrap: wrap; gap: 15px; }

/* State Machine Buttons */
.rm-action-btn { padding: 8px 16px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; color: white; transition: 0.2s; white-space: nowrap; width: 100%; text-align: center; }
.rm-btn-blue { background: var(--primary-color); }
.rm-btn-orange { background: #F59E0B; }
.rm-btn-green { background: #10B981; }
.rm-btn-dark { background: #1F2937; }
.rm-action-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.rm-input-small { padding: 8px 12px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 14px; }

/* Stats Grid */
.rm-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 25px; }
.rm-stat-card { background: white; padding: 25px; border-radius: 12px; border-left: 5px solid var(--primary-color); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.rm-stat-info h3 { font-size: 30px; color: #1F2937; margin-bottom: 5px; }
.rm-stat-info p { color: #6B7280; font-size: 14px; font-weight: 600; text-transform: uppercase; margin: 0; }
.rm-owner-controls { margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.rm-period-btn { padding: 8px 20px; background: white; border: 1px solid #D1D5DB; border-radius: 6px; cursor: pointer; font-weight: bold; color:#4B5563; }
.rm-period-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* Form Elements */
.rm-form-group { margin-bottom: 15px; }
.rm-form-group label { display: block; font-weight: 600; margin-bottom: 5px; color: #374151; font-size: 14px; }

/* ============================================
   MOBILE RESPONSIVENESS (DASHBOARD)
   ============================================ */
@media (max-width: 768px) {
    .rm-dashboard-wrapper { padding: 15px; }
    .rm-dash-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .rm-dash-tabs { width: 100%; overflow-x: auto; padding-bottom: 5px; }
    .rm-dash-tab { white-space: nowrap; }
    
    .rm-dash-grid { grid-template-columns: 1fr; }
    .rm-form-row-mobile { flex-direction: column; }
    
    .rm-card-bottom { flex-direction: column; align-items: stretch; }
    .rm-card-bottom > div { width: 100% !important; text-align: left !important; }
    .rm-close-box { flex-direction: column; }
}

/* ============================================
   MODULE 4: KITCHEN DISPLAY SYSTEM (KDS)
   ============================================ */

.rm-kds-wrapper { 
    min-height: 100vh; 
    background: #111827; 
    color: white; 
    padding: 20px; 
    font-family: -apple-system, sans-serif; 
}
.rm-kds-header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 25px; background: #1F2937; padding: 15px 25px; 
    border-radius: 10px; border: 1px solid #374151; flex-wrap: wrap; gap: 15px; 
}
.rm-kds-header h1 { font-size: 24px; color: #F9FAFB; margin:0; }
.rm-kds-time { font-size: 20px; font-weight: 700; color: #60A5FA; }

/* 🌟 MAGIC FIX 1: Tighter max-width (980px instead of 1200px) brings columns perfectly close */
.rm-kds-table-container { 
    background: #1F2937; 
    border-radius: 10px; 
    overflow-x: hidden !important; 
    border: 1px solid #374151; 
    max-width: 980px !important; /* Forces the table to be compact and close the gap */
    margin: 0 auto;              /* Keeps it beautifully centered */
}

.rm-kds-table { 
    width: 100%; 
    border-collapse: collapse; 
    text-align: left; 
    table-layout: fixed !important; 
}
.rm-kds-table th { background: #111827; padding: 15px 20px; color: #9CA3AF; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid #374151; }
.rm-kds-table td { padding: 16px 20px; border-bottom: 1px solid #374151; vertical-align: middle; }

/* 🌟 MAGIC FIX 2: Re-balanced column widths for Desktop */
@media (min-width: 769px) {
    .rm-kds-table th:nth-child(1), .rm-kds-table td:nth-child(1) { width: 16%; padding-left: 25px; }
    .rm-kds-table th:nth-child(2), .rm-kds-table td:nth-child(2) { width: 12%; text-align: center; } 
    .rm-kds-table th:nth-child(3), .rm-kds-table td:nth-child(3) { width: 22%; }
    .rm-kds-table th:nth-child(4), .rm-kds-table td:nth-child(4) { width: 30%; } /* Reduced width so it doesn't push Status away */
    .rm-kds-table th:nth-child(5), .rm-kds-table td:nth-child(5) { width: 20%; text-align: left; } /* Changed to left align to hug the items closer */
}

.rm-kds-row { transition: background 0.3s; }
.rm-kds-row:hover { background: #374151; }
.rm-row-highlight { background: rgba(59, 130, 246, 0.1); border-left: 4px solid #3B82F6; }

.rm-kds-table-box { background: #FCA5A5; color: #991B1B; display: inline-block; padding: 8px 16px; border-radius: 8px; font-size: 22px; font-weight: 900; }
.rm-kds-badge { padding: 8px 15px; border-radius: 6px; font-size: 13px; font-weight: bold; display: inline-block; white-space: nowrap; text-align: center;}
.rm-badge-gray { background: #374151; color: #D1D5DB; }
.rm-badge-blue { background: #3B82F6; color: #EFF6FF; box-shadow: 0 0 10px rgba(59,130,246,0.4); }
.rm-badge-green { background: #10B981; color: #ECFDF5; }

/* ============================================
   KITCHEN DISPLAY (KDS) MOBILE PURE NO-SCROLL FIX
   ============================================ */
@media (max-width: 768px) {
    .rm-kds-table th, .rm-kds-table td { 
        padding: 8px 4px !important; 
        font-size: 10px !important; 
        white-space: normal !important; 
        vertical-align: middle !important;
    }
    
    .rm-kds-table th { font-size: 9px !important; padding: 6px 2px !important; }
    
    .rm-kds-table td:nth-child(1) { width: 16%; font-size: 9.5px !important; }
    .rm-kds-table td:nth-child(2) { width: 10%; text-align: center; }
    .rm-kds-table td:nth-child(3) { width: 22%; word-break: break-all !important; font-size: 8.5px !important; } 
    .rm-kds-table td:nth-child(4) { width: 32%; }
    .rm-kds-table td:nth-child(5) { width: 20%; text-align: center; }

    .rm-kds-table-box { padding: 4px 6px !important; font-size: 12px !important; }
    .rm-kds-badge { padding: 4px !important; font-size: 8.5px !important; white-space: normal !important; width: 100%; box-sizing: border-box; }
}

/* ============================================
   MOBILE VIEW FIX: FORCE ALL TABLES ON SCREEN
   (Only applies to mobile screens under 768px)
   ============================================ */
@media (max-width: 768px) {
    
    /* --- 1. Dashboard Reports & Menu Manager Fix --- */
    .rm-table-responsive { 
        overflow-x: auto !important; 
        -webkit-overflow-scrolling: touch;
    }
    
    .rm-professional-table { 
        min-width: 100% !important; 
        table-layout: auto !important; 
        width: 100%; 
    }
    
    .rm-professional-table th, 
    .rm-professional-table td {
        padding: 8px 6px !important; 
        font-size: 11px !important; 
        white-space: normal !important; 
        word-wrap: break-word; 
        vertical-align: middle !important; 
    }

    /* 🌟 Detailed Report Table Optimizations */
    #owner-section .rm-professional-table th,
    #owner-section .rm-professional-table td {
        font-size: 10px !important; 
        padding: 8px 6px !important; 
        line-height: 1.3 !important;
        letter-spacing: 0 !important;
    }
    
    /* 🌟 MAGIC FIX: Stop vertical text! Keep Date and Order ID on one single line */
    #owner-section .rm-professional-table th:nth-child(1),
    #owner-section .rm-professional-table td:nth-child(1) div,
    #owner-section .rm-professional-table th:nth-child(2),
    #owner-section .rm-professional-table td:nth-child(2) {
        white-space: nowrap !important; /* Keeps text perfectly in a single line */
        word-break: normal !important; /* Removes the ugly character-by-character breaking */
        width: auto !important;
        min-width: max-content !important;
    }

    #owner-section .rm-professional-table th:nth-child(3),
    #owner-section .rm-professional-table td:nth-child(3) {
        text-align: center;
    }
    
    /* 🌟 Menu Manager specific fixes */
    .rm-btn-text { display: none !important; } 
    .rm-icon-btn { padding: 6px 8px !important; font-size: 14px !important; width: auto !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; }
    .rm-action-group { flex-direction: row !important; align-items: center !important; flex-wrap: nowrap !important; gap: 6px !important; }
    .rm-switch { width: 34px !important; height: 18px !important; min-width: 34px !important; flex-shrink: 0; margin: 0 !important; display: inline-block !important; }
    .rm-slider:before { height: 14px !important; width: 14px !important; left: 2px !important; bottom: 2px !important; }
    input:checked + .rm-slider:before { transform: translateX(16px) !important; }
    .rm-badge-status { padding: 4px !important; font-size: 8.5px !important; white-space: normal !important; display: inline-block; }
	
}

/* ============================================
   TABLET VIEW OPTIMIZATION
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    
    /* Dashboard Tables for Tablet */
    .rm-professional-table th,
    .rm-professional-table td {
        padding: 12px 10px !important;
        font-size: 13px !important; 
    }

    /* KDS Tables for Tablet */
    .rm-kds-table th,
    .rm-kds-table td {
        padding: 12px 10px !important;
        font-size: 13px !important;
    }
    
    .rm-kds-table td[style] {
        font-size: 14px !important; 
    }
    
    .rm-kds-table ul li {
        font-size: 14px !important;
    }
    
    .rm-kds-table-box {
        padding: 6px 12px !important;
        font-size: 18px !important; 
    }

    /* Dashboard Grid - Force 2 columns on tablet */
    .rm-dash-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ============================================
   🌟 NEW: FOOTER STYLES
   ============================================ */
.rm-footer {
    background-color: var(--primary-color); 
    color: white;
    text-align: center;
    padding: 25px 20px;
    margin-top: auto !important; 
    
    /* Magic CSS to force full width across the entire screen */
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    box-sizing: border-box;
}

.rm-footer p { 
    margin: 0; 
    font-size: 15px; 
    letter-spacing: 0.5px; 
}

.rm-footer-link {
    color: white !important;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.4); 
    transition: all 0.3s ease;
}

/* Hover Effect: Text color changes to Warning/Yellow color on hover */
.rm-footer-link:hover {
    color: var(--warning-color) !important; 
    border-bottom-color: var(--warning-color);
}

/* ============================================
   🌟 NEW: RECEIPT MODAL & PRINT STYLES
   ============================================ */
.rm-receipt-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); padding: 20px;
}
.rm-receipt-box {
    background: white; width: 100%; max-width: 400px;
    border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden; display: flex; flex-direction: column;
    max-height: 90vh;
}
.rm-receipt-print-area {
    padding: 30px; overflow-y: auto; background: white;
    font-family: monospace; /* Professional thermal printer look */
}
.rm-receipt-actions {
    padding: 15px; background: #F3F4F6; border-top: 1px solid #E5E7EB;
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* Magic CSS: When Print is clicked, hide EVERYTHING except the receipt! */
@media print {
    body * { visibility: hidden; }
    #rm-receipt-overlay, #rm-receipt-overlay * { visibility: visible; }
    .rm-receipt-actions { display: none !important; }
    .rm-receipt-overlay { position: absolute; left: 0; top: 0; padding: 0; background: white; align-items: flex-start; }
    .rm-receipt-box { box-shadow: none; border-radius: 0; max-width: 100%; }
    .rm-receipt-print-area { padding: 0; font-size: 12pt; color: black;}
}