/*
 * Mobile Styles - Mimino Restaurant 2026
 * Clean mobile-first design inspired by modern patterns
 */

/* === BASE === */
html, body {
  /* Paired with style.css: clip prevents horizontal scroll without making
     body a scroll container, so sticky nav + sticky categories work. */
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* === FIX BACKGROUND AND CONTAINER FOR MOBILE === */
@media (max-width: 768px) {
  /* Dark background from mimino.delivery — uniform dark surface,
     no header image so categories sit on a continuous black backdrop. */
  body {
    background:
      url("images/dark_background.21ddebbc1532.jpg") top center / 100% auto repeat-y !important;
    background-color: #1a1412 !important;
    background-attachment: scroll !important;
  }

  /* Fix container overflow to allow sticky positioning + transparent bg */
  .container {
    overflow: visible !important;
    overflow-y: visible !important;
    background: transparent !important;
  }

  /* Phone number - black text on light background */
  .info-item a[href^="tel"],
  .header-container a[href^="tel"] {
    color: #1a1a1a !important;
  }

  /* Category slider at top - keep dark/black text */
  .sub-nav .sub-nav-item,
  .sub-nav .sub-nav-item span {
    color: var(--text-primary, #2D2926) !important;
    text-shadow: none !important;
  }

  /* Category headers before dishes - white text for visibility on dark bg */
  .cat-name,
  .section-text h2,
  .section-text p,
  .menu-content section h2 {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
  }

  /* Category description text - lighter color */
  .section-text p {
    color: rgba(255, 255, 255, 0.85) !important;
  }
}

* {
  box-sizing: border-box;
}

/* === MOBILE NAVIGATION === */
@media (max-width: 768px) {
  body.nav-open {
    overflow: hidden;
  }

  .main-nav {
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(15px, env(safe-area-inset-right, 0px)) 8px max(15px, env(safe-area-inset-left, 0px));
    min-height: 60px;
    height: auto;
    justify-content: space-between;
  }

  .brand {
    position: static;
    transform: none;
  }

  .brand a {
    font-size: 1.4rem;
  }

  /* Hide desktop language switch */
  .desktop-lang-switch {
    display: none !important;
  }

  /* Hamburger button */
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary, #2D2926);
    font-size: 1.5rem;
    padding: 0;
    z-index: 1001;
  }

  /* Mobile cart button */
  .mobile-cart {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--brand-gold, #C9A456);
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
  }

  .mobile-cart .cart-count {
    background: white;
    color: var(--brand-gold-dark, #A68736);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-cart .cart-summary {
    font-size: 14px;
  }

  /* Nav links - dropdown menu */
  .nav-links {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary, #FDFBF7);
    flex-direction: column;
    padding: 0;
    gap: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary, #2D2926);
    border-bottom: 1px solid var(--bg-tertiary, #EDE6DA);
    text-decoration: none;
    transition: background 0.2s ease;
  }

  .nav-links a:hover,
  .nav-links a:active {
    background: var(--bg-secondary, #F5F0E8);
  }

  .nav-links a i {
    margin-right: 12px;
    color: var(--brand-gold, #C9A456);
    width: 20px;
  }

  /* Hide desktop cart in menu */
  .nav-links .nav-cart-link {
    display: none !important;
  }

  /* Language switch in menu */
  .nav-links .lang-switch {
    display: flex;
    padding: 20px;
    gap: 10px;
    background: var(--bg-secondary, #F5F0E8);
    margin-top: auto;
  }

  .nav-links .lang-switch button {
    flex: 1;
    padding: 14px;
    background: white;
    border: 1px solid var(--bg-tertiary, #EDE6DA);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #2D2926);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .nav-links .lang-switch button:active {
    background: var(--brand-gold-light, #E5D4A4);
    border-color: var(--brand-gold, #C9A456);
  }
}

/* === HEADER INFO === */
@media (max-width: 768px) {
  .header-container {
    padding: 15px;
    margin-top: 0;
  }

  .info-column {
    flex-direction: column;
    gap: 10px;
  }

  .info-item {
    flex-direction: row;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--bg-tertiary, #EDE6DA);
    gap: 12px;
  }

  .info-item i {
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gold-light, #E5D4A4);
    color: var(--brand-gold-dark, #A68736);
    border-radius: 8px;
    flex-shrink: 0;
  }

  .info-text h3 {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .info-text p,
  .info-text li,
  .info-text a {
    font-size: 13px;
    margin: 0;
  }

  .working-hours {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 15px;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .info-item-hours {
    width: 100%;
    justify-content: flex-start;
    cursor: pointer;
  }
}

/* === HERO SECTION === */
@media (max-width: 768px) {
  .hero {
    min-height: 50vh;
    padding: 20px;
    padding-top: 10vh;
  }

  .hero .overlay {
    padding: 25px 20px;
    max-width: 100%;
  }

  .hero .overlay h1 {
    font-size: 1.3rem;
    line-height: 1.4;
  }

  .hero .overlay p {
    font-size: 14px;
    line-height: 1.5;
  }

  .hero .overlay p br {
    display: none;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .hero-btn {
    width: 100%;
    justify-content: center;
    padding: 16px 24px;
    font-size: 15px;
  }

  .hero-decor-left {
    display: none;
  }
}

/* === MENU PAGE === */
@media (min-width: 431px) and (max-width: 768px) {
  .menu-page {
    padding: 10px;
    background: transparent !important;
  }

  /* Category navigation is styled in menu.css (horizontal scroll strip) */

  /* Dish cards on mobile — keep design-system card shape, just tighter */
  .section-image {
    width: 60px;
    height: 60px;
  }

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

/* === CART PAGE === */
@media (max-width: 768px) {
  .cart {
    margin: 10px !important;
    padding: 20px 15px !important;
    padding-bottom: 120px !important; /* Space for sticky button */
  }

  .cart h2 {
    font-size: 1.3rem !important;
    margin-bottom: 20px !important;
  }

  .cart-item {
    padding: 15px !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
  }

  .item-image img {
    width: 70px !important;
    height: 70px !important;
  }

  .item-details h3 {
    font-size: 14px !important;
  }

  .item-details p {
    font-size: 12px !important;
  }

  .item-quantity-controls {
    margin: 10px 0 !important;
  }

  .quantity-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
  }

  /* Sticky checkout bar */
  .cart-actions {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    padding: 15px !important;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1) !important;
    backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    margin: 0 !important;
    z-index: 100 !important;
    flex-direction: row !important;
    gap: 10px !important;
  }

  .cart-actions .left-actions {
    display: none !important;
  }

  .cart-actions .center-actions {
    flex: 1 !important;
    order: 2 !important;
  }

  .cart-actions .right-actions {
    flex: 2 !important;
    order: 1 !important;
  }

  .continue-shopping-btn {
    padding: 14px !important;
    font-size: 13px !important;
    width: 100% !important;
  }

  .checkout-btn {
    padding: 14px 20px !important;
    font-size: 15px !important;
    width: 100% !important;
  }
}

/* === RESERVATION FORM === */
@media (max-width: 768px) {
  .reservation-widget {
    margin: 15px;
    padding: 20px;
  }

  .reservation-widget h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
  }

  .reservation-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dropdown-header {
    padding: 14px 16px;
    font-size: 15px;
  }

  .dropdown-list {
    max-height: 250px;
  }

  .dropdown-item {
    padding: 14px 16px;
    font-size: 15px;
  }

  .reservation-submit {
    padding: 16px;
    font-size: 16px;
    margin-top: 10px;
  }

  /* Contact form */
  .reservation-input {
    padding: 14px 16px;
    font-size: 16px;
  }

  textarea.reservation-input {
    min-height: 80px;
  }

  .step-buttons {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .step-buttons .btn-back,
  .step-buttons .reservation-submit {
    width: 100%;
    padding: 14px;
  }

  .booking-summary {
    padding: 15px;
  }

  .booking-summary p {
    font-size: 14px;
  }
}

/* === LANGUAGE MODAL === */
@media (max-width: 768px) {
  .lang-modal-content {
    width: 90%;
    padding: 30px 20px;
  }

  .lang-modal-header h2 {
    font-size: 1.1rem;
  }

  .lang-modal-header p {
    font-size: 14px;
  }

  .lang-modal-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .lang-btn {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
    padding: 16px;
  }

  .lang-flag {
    font-size: 1.8rem;
  }

  .lang-name {
    font-size: 16px;
  }
}

/* === PROMO POPUP === */
@media (max-width: 768px) {
  .promo-popup-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .promo-popup {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }

  .promo-popup-close {
    width: 36px;
    height: 36px;
    font-size: 24px;
    top: 10px;
    right: 10px;
  }

  .promo-popup-image {
    max-height: 180px;
  }

  .promo-popup-content {
    padding: 20px;
  }

  .promo-popup-content h2 {
    font-size: 1.2rem;
  }

  .promo-popup-content p {
    font-size: 14px;
  }

  .promo-phone {
    font-size: 1.3rem;
    padding: 12px 20px;
    display: inline-block;
  }
}

/* === ORDERS PAGE === */
@media (max-width: 768px) {
  .order-card {
    padding: 15px;
    margin-bottom: 15px;
  }

  .order-card h3 {
    font-size: 16px;
  }

  .order-card p {
    font-size: 13px;
  }
}

/* === FOOTER === */
@media (max-width: 768px) {
  footer {
    padding: 20px 15px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
    text-align: center;
  }

  .brand-footer a {
    font-size: 1.3rem;
  }
}

/* === FORMS - Prevent iOS Zoom === */
@media (max-width: 768px) {
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* === TOUCH FEEDBACK === */
@media (hover: none) and (pointer: coarse) {
  .dish:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  .order-button:active,
  .checkout-btn:active,
  .reservation-submit:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  button:active,
  a:active {
    opacity: 0.8;
  }
}

/* === SAFE AREA (iPhone X+) === */
@supports (padding: env(safe-area-inset-bottom)) {
  .cart-actions {
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
  }

  .nav-links {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* === SCROLL TO TOP BUTTON === */
.scroll-to-top {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .scroll-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    right: 15px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--brand-gold, #C9A456), var(--brand-gold-dark, #A68736));
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
  }

  .scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .scroll-to-top:active {
    transform: scale(0.9);
  }

  /* RTL position */
  html[lang="he"] .scroll-to-top {
    right: auto;
    left: 15px;
  }
}

/* === MOBILE BOTTOM TAB BAR === */
.mobile-tabbar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 105;
    justify-content: space-around;
    align-items: stretch;
    background: rgba(253, 251, 247, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--bg-tertiary, #EDE6DA);
    padding: 6px 0 max(6px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(45, 41, 38, 0.08);
  }

  .mobile-tabbar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    color: var(--text-muted, #8B857D);
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.01em;
    position: relative;
    transition: color 0.2s ease, transform 0.2s ease;
    min-height: 48px;
  }

  .mobile-tabbar .tab-item i {
    font-size: 19px;
    line-height: 1;
  }

  .mobile-tabbar .tab-item span:not(.tab-badge) {
    line-height: 1;
  }

  .mobile-tabbar .tab-item.active,
  .mobile-tabbar .tab-item:active {
    color: var(--brand-gold-dark, #A68736);
  }

  .mobile-tabbar .tab-item.active::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(135deg, var(--brand-gold, #C9A456), var(--brand-gold-dark, #A68736));
  }

  .mobile-tabbar .tab-item:active {
    transform: scale(0.94);
  }

  .mobile-tabbar .tab-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    background: var(--error, #B44444);
    color: #fff;
    border-radius: 9999px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    line-height: 1;
  }

  .mobile-tabbar .tab-badge[hidden] {
    display: none;
  }

  /* Reserve space for the tab bar at the bottom of the scroll area */
  body {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Hide the legacy mobile cart pill — the tab bar owns this now */
  .main-nav .mobile-cart {
    display: none !important;
  }

  /* Lift sticky checkout above the tab bar */
  .cart-actions {
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: 12px !important;
  }

  .scroll-to-top {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  /* Hide the "bottom info" footer on mobile since tab bar fills that role */
  footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* === RTL SUPPORT (Hebrew) === */
html[lang="he"] {
  direction: rtl;
}

@media (max-width: 768px) {
  html[lang="he"] .nav-links a {
    flex-direction: row-reverse;
  }

  html[lang="he"] .nav-links a i {
    margin-right: 0;
    margin-left: 12px;
  }

  html[lang="he"] .info-item {
    flex-direction: row-reverse;
  }

  /* Dishes are vertical cards, no need for row-reverse */
  html[lang="he"] .dish {
    flex-direction: column;
  }

  html[lang="he"] .mobile-cart {
    flex-direction: row-reverse;
  }

  html[lang="he"] .hero-buttons {
    flex-direction: column;
  }
}

/* ============================================
   TOUCH TARGETS (≥ 44px) & TAP POLISH
   Enforces iOS/Android minimum tappable area.
   ============================================ */
@media (max-width: 768px) {
  /* Key primary actions hit the 44px minimum */
  .dish .add-btn,
  .dish .order-button,
  .btn-lightbox-add,
  .reservation-submit,
  .reservation-input[type="tel"],
  .reservation-input[type="text"],
  .dropdown-header,
  .sub-nav .sub-nav-item,
  .clear-cart-btn,
  .continue-shopping-btn,
  .checkout-btn,
  .mobile-menu-toggle,
  .quick-close,
  .cart-close,
  .tab-item,
  .a11y-fab,
  .call-fab,
  .chat-fab,
  .quantity-btn {
    min-height: 44px;
  }

  /* +/- quantity pills: circular, 36px is the design target, but ensure
     the wrapping form has a 44px tappable area via padding. */
  .item-quantity-controls .quantity-btn {
    min-width: 44px;
  }

  /* Bigger form inputs — also prevents iOS zoom (min 16px font) */
  .field input,
  .field select,
  .field textarea,
  .reservation-input,
  #comment-text {
    font-size: 16px;
    min-height: 48px;
  }

  /* Tab bar rows: ensure 48px tall per apple HIG */
  .mobile-tabbar .tab-item {
    min-height: 48px;
  }

  /* Quick-order tile — full-width tap area */
  .quick-tile {
    min-height: 96px;
  }
}

/* ============================================
   STAGE-1 DRAWER FIT-AND-FINISH
   Guarantees the drawer wins on mobile even if
   other .nav-links rules target the same element.
   ============================================ */
@media (max-width: 768px) {
  .main-nav .nav-links.drawer-style {
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: 80% !important;
    max-width: 320px !important;
    height: 100vh !important;
    background: var(--bg-primary, #FDFBF7) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 10px 0 40px rgba(45, 41, 38, 0.25);
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto;
    z-index: 150 !important;
  }
  .main-nav .nav-links.drawer-style.active {
    transform: translateX(0) !important;
  }
  .nav-scrim.active {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* When the drawer is open, lift .main-nav's stacking context above the
     scrim. Without this, the drawer (which lives *inside* .main-nav) is
     capped by its parent's z-index (104) and paints BELOW the scrim
     (z:149) that sits at the document root — so the blur and dim leak
     over the drawer content. Reverts the moment the drawer closes. */
  body.nav-open .main-nav {
    z-index: 200 !important;
  }
}

