/* ============================================
   RAYO Restaurant - MOBILE-FIRST RESPONSIVE FRAMEWORK
   Base = mobile. Enhance with min-width for tablet/desktop.
   ============================================ */

/* ============================================
   1. BASE (MOBILE) STYLES – default for all viewports
   ============================================ */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ============================================
   2. NAVIGATION – mobile first: hamburger visible, desktop nav hidden
   ============================================ */

/* Mobile: hamburger visible by default */
.mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: rgba(15, 15, 25, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-icon {
    width: 30px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* Mobile navigation drawer */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: linear-gradient(135deg, #0f0f19 0%, #1a1a2e 100%);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
}

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

.mobile-nav-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-nav-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.mobile-nav-links {
    padding: 20px 0;
}

.mobile-nav-links a {
    display: block;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-links a:active {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-links a i {
    margin-right: 10px;
    width: 20px;
    display: inline-block;
}

/* ============================================
   3. MOBILE TYPOGRAPHY
   ============================================ */

h1 {
    font-size: 1.8rem;
    line-height: 1.3;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.3rem;
    line-height: 1.3;
}

h4 {
    font-size: 1.1rem;
    line-height: 1.3;
}

p {
    font-size: 1rem;
    line-height: 1.6;
}

/* ============================================
   4. MOBILE BUTTONS & INTERACTIONS
   ============================================ */

.btn, button, .btn-primary, .btn-secondary, .btn-success, .btn-warning, .btn-danger {
    min-height: 48px;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 8px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active, button:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Large touch targets */
.touch-target {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   5. MOBILE CARDS & CONTAINERS
   ============================================ */

.card {
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* ============================================
   6. MOBILE FORMS
   ============================================ */

input, select, textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    min-height: 48px;
    padding: 12px 15px;
    border-radius: 8px;
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

label {
    font-size: 1rem;
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

/* ============================================
   6b. MOBILE STATUS / STEP ROWS (no overflow)
   ============================================ */

/* Any horizontal row of status steps (e.g. Placed → Confirmed → … → Delivered) */
.d-flex.justify-content-between + .progress,
.delivery-step-labels + .progress,
.delivery-steps .progress,
.delivery-timeline .progress {
    max-width: 100%;
    min-width: 0;
}
.delivery-step-labels,
.delivery-steps .d-flex:first-child,
.delivery-timeline .d-flex:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem 0.5rem !important;
    justify-content: space-between !important;
    max-width: 100%;
}
.delivery-step-labels span,
.delivery-steps .d-flex:first-child span,
.delivery-timeline .d-flex:first-child span {
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
}
@media (min-width: 576px) {
    .delivery-step-labels span,
    .delivery-steps .d-flex:first-child span,
    .delivery-timeline .d-flex:first-child span {
        font-size: 0.875rem !important;
    }
}

/* ============================================
   7. MOBILE TABLES
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.mobile-table {
    display: block;
    width: 100%;
}

.mobile-table thead {
    display: none;
}

.mobile-table tbody {
    display: block;
}

.mobile-table tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
}

.mobile-table td {
    display: block;
    text-align: left;
    padding: 8px 0;
    border: none;
}

.mobile-table td:before {
    content: attr(data-label);
    font-weight: bold;
    display: inline-block;
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   8. MOBILE MODALS
   ============================================ */

.modal {
    padding: 0 !important;
}

.modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px 15px;
}

.modal-footer {
    padding: 15px;
    flex-direction: column;
}

.modal-footer .btn {
    width: 100%;
    margin: 5px 0;
}

/* ============================================
   9. MOBILE CALENDAR
   ============================================ */

.calendar-grid {
    gap: 5px;
    font-size: 0.9rem;
}

.calendar-day {
    min-height: 80px;
    padding: 8px;
}

.day-number {
    font-size: 1rem;
}

.day-meal, .day-prompt {
    font-size: 0.75rem;
}

/* ============================================
   10. MOBILE MEAL PASS CARDS
   ============================================ */

.meal-pass-card {
    margin-bottom: 20px;
    padding: 20px;
}

.pass-name {
    font-size: 1.3rem;
}

.pass-price {
    font-size: 1.8rem;
}

.pass-features {
    font-size: 0.9rem;
}

/* ============================================
   11. MOBILE MENU ITEMS
   ============================================ */

.menu-item-card {
    margin-bottom: 15px;
}

.menu-item-image {
    height: 200px;
    object-fit: cover;
}

.menu-item-details {
    padding: 15px;
}

/* ============================================
   12. MOBILE CART
   ============================================ */

.cart-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-summary {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* ============================================
   13. MOBILE SPACING
   ============================================ */

.mobile-spacing {
    padding: 15px 0;
}

.mobile-section {
    margin-bottom: 30px;
}

/* ============================================
   14. MOBILE ALERTS
   ============================================ */

.alert {
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* ============================================
   15. MOBILE UTILITIES (mobile-first: mobile visible, desktop hidden by default)
   ============================================ */

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

/* Mobile: hide desktop nav by default; hamburger handles navigation */
.navbar-collapse {
    display: none !important;
}

/* Mobile: full-width container, compact padding */
.container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

/* Stack columns on small viewports only (max-width so Bootstrap grid works on desktop) */
@media (max-width: 991.98px) {
    .row > [class*="col-"] {
        width: 100%;
        padding: 0 15px;
        margin-bottom: 15px;
    }
}

/* Mobile: vertical button groups */
.btn-group {
    flex-direction: column;
}

.btn-group .btn {
    width: 100%;
    margin: 5px 0;
}

/* Mobile: compact navbar */
.navbar {
    padding: 10px 15px;
}

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

/* Mobile: stacked calendar controls */
.calendar-controls {
    flex-direction: column;
    gap: 10px;
}

.calendar-controls button {
    width: 100%;
}

/* Mobile: footer */
footer {
    padding: 20px 15px;
    text-align: center;
}

footer .row > div {
    margin-bottom: 20px;
}

.mobile-text-center {
    text-align: center;
}

.mobile-full-width {
    width: 100%;
}

.mobile-hide {
    display: none;
}

/* ============================================
   16. RESPONSIVE BREAKPOINTS (mobile-first: min-width only)
   ============================================ */

/* Tablet: 768px and up */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
}

/* Desktop: 992px and up – show desktop nav, hide hamburger */
@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .navbar-collapse {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100%;
    }
    
    /* Keep main nav links in one row on the left */
    .navbar-collapse > .navbar-nav:first-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        margin-right: auto;
        gap: 0;
    }
    
    .navbar-collapse > .navbar-nav:first-child .nav-item {
        white-space: nowrap;
    }
    
    .navbar-collapse > .navbar-nav:first-child .nav-link {
        padding: 0.5rem 0.75rem;
    }
    
    /* Cart / right-side nav stays on the right */
    .navbar-collapse > .navbar-nav:last-child {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        margin-left: auto;
    }
    
    .container {
        max-width: 960px;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    .mobile-hide {
        display: block;
    }
    
    .btn-group {
        flex-direction: row;
    }
    
    .btn-group .btn {
        width: auto;
        margin: 0;
    }
    
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar .container {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    
    .navbar .navbar-toggler {
        display: none;
    }
    
    .calendar-controls {
        flex-direction: row;
    }
    
    .calendar-controls button {
        width: auto;
    }
}

/* Large desktop: 1200px and up */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* ============================================
   17. TOUCH INTERACTIONS
   ============================================ */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better touch scrolling */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* Prevent text selection on buttons */
button, .btn, a.btn {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Active states for better feedback */
a:active, button:active, .btn:active {
    opacity: 0.8;
}

/* ============================================
   18. MOBILE LOADING STATES
   ============================================ */

.mobile-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.mobile-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   19. MOBILE SAFE AREAS (iOS)
   ============================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .navbar {
        padding-top: max(10px, env(safe-area-inset-top));
    }
    
    .cart-summary {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   20. ACCESSIBILITY
   ============================================ */

/* Focus states for keyboard navigation */
*:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   21. PRINT STYLES
   ============================================ */

@media print {
    .mobile-menu-toggle,
    .mobile-nav-drawer,
    .navbar,
    footer,
    .btn {
        display: none;
    }
    
    body {
        font-size: 12pt;
        color: black;
        background: white;
    }
}
