/* ==========================================================================
   MARSA Seafood Restaurant - Enhanced Mobile & Responsive Design System
   Optimized for all viewport sizes (Desktop, Tablet, Mobile Phablet, Phones)
   ========================================================================== */

/* ----------------- Touch & Global Viewport Optimizations ----------------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body.menu-open {
  overflow: hidden;
  touch-action: none;
}

/* Mobile Nav Overlay Backdrop */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 20, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Hamburger Icon Transformation to X */
.mobile-toggle.active span:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
  background-color: var(--accent-gold);
}
.mobile-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.mobile-toggle.active span:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
  background-color: var(--accent-gold);
}

/* Floating WhatsApp Quick Contact Button */
.floating-whatsapp-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.9);
  z-index: 990;
  transition: all 0.25s ease;
  text-decoration: none;
}

.floating-whatsapp-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.6);
  color: #FFFFFF;
}

.floating-whatsapp-btn svg {
  display: block;
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* ==========================================================================
   1. Large Screens & Laptops (<= 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 2rem;
  }
}

/* ==========================================================================
   2. Tablets & Small Laptops (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {
  .site-header {
    padding: 0.75rem 0;
  }

  .brand-logo img {
    max-width: 160px;
    height: auto;
  }

  .mobile-toggle {
    display: flex;
  }

  /* Slide-in Mobile Navigation Drawer */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(85vw, 320px);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #0A1B30 0%, #050E1A 100%);
    border-left: 1px solid rgba(212, 175, 55, 0.35);
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 1.75rem 2rem;
    gap: 0.6rem;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -15px 0 35px rgba(0, 0, 0, 0.85);
    z-index: 999;
    overflow-y: auto;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--accent-gold-light);
    border-color: rgba(212, 175, 55, 0.3);
    padding-right: 1.4rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .hero-wrapper {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  /* Multi-Column Layouts across pages */
  .res-grid,
  .order-grid,
  [style*="grid-template-columns: 1.1fr 0.9fr"],
  [style*="grid-template-columns: 1.2fr 0.8fr"],
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns: 0.9fr 1.1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
}

/* ==========================================================================
   3. Mobile Devices & Small Tablets (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Global Inputs: Force 16px to prevent iOS auto-zoom */
  input, select, textarea, .form-control {
    font-size: 16px !important;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  /* Typography Fluid Scaling */
  .hero-section {
    padding: 6.5rem 0 3.5rem;
  }

  .hero-title {
    font-size: clamp(1.85rem, 6vw, 2.5rem) !important;
    line-height: 1.35 !important;
    margin-bottom: 1rem !important;
  }

  .hero-title span {
    display: inline-block;
  }

  .hero-direct-content p {
    font-size: 1.05rem !important;
    line-height: 1.7 !important;
    margin-bottom: 2rem !important;
  }

  /* Hero Action Buttons - Scaled Down & Refined for Mobile */
  .hero-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.55rem !important;
    width: 100% !important;
    max-width: 270px !important;
    margin: 0 auto 1.35rem !important;
  }

  .hero-actions .btn,
  .hero-actions .hero-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.62rem 1rem !important;
    font-size: 0.9rem !important;
    min-height: 40px !important;
    border-radius: var(--radius-full) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  }

  /* Hero Stats - Compact 3-Column Single Row */
  .hero-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.4rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding-top: 1.1rem !important;
    margin: 0 auto !important;
    max-width: 380px !important;
    width: 100% !important;
  }

  .hero-stat-item {
    text-align: center !important;
    padding: 0 0.3rem !important;
  }

  .hero-stat-item:not(:first-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding-right: 0.3rem !important;
  }

  .hero-stat-num {
    font-size: 1.35rem !important;
    line-height: 1.15 !important;
    margin-bottom: 0.2rem !important;
    font-weight: 800 !important;
  }

  .hero-stat-label {
    font-size: 0.72rem !important;
    line-height: 1.35 !important;
    color: rgba(241, 245, 249, 0.88) !important;
  }

  .section-header {
    margin-bottom: 2.25rem;
  }

  .section-title {
    font-size: clamp(1.5rem, 5vw, 2rem) !important;
    line-height: 1.35;
  }

  .section-description {
    font-size: 0.95rem;
  }

  /* All Multi-Column Form Rows Stack to 1 Column */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  .form-row-2col,
  .form-group-row {
    grid-template-columns: 1fr !important;
    gap: 1.15rem !important;
  }

  /* Large Card Padding & Margin Reduction */
  [style*="padding: 3rem"],
  [style*="padding: 3.5rem"] {
    padding: 1.5rem 1.25rem !important;
  }

  [style*="gap: 3.5rem"],
  [style*="gap: 4rem"] {
    gap: 1.75rem !important;
  }

  [style*="margin-bottom: 6rem"],
  [style*="margin-bottom: 4rem"],
  [style*="margin-bottom: 3.5rem"] {
    margin-bottom: 2.25rem !important;
  }

  /* Menu Page Filter Bar: Smooth Horizontal Swipe */
  .menu-filter-bar {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
  }

  .menu-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.65rem 1.15rem;
    font-size: 0.9rem;
    border-radius: var(--radius-full);
  }

  /* Dish Grid on Mobile */
  #menuGridContainer,
  .dishes-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .dish-media {
    height: 200px;
  }

  .dish-content {
    padding: 1.25rem;
  }

  .dish-actions {
    flex-direction: column;
    gap: 0.65rem;
  }

  .dish-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Calculator Card on Menu Page */
  .calc-card {
    padding: 1.5rem 1.25rem;
  }

  .calc-card [style*="display: flex; gap: 1rem; align-items: center;"] {
    flex-wrap: wrap;
  }

  /* Experience Feature Cards (index.html) */
  [style*="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .experience-direct-feature {
    padding: 1.5rem;
  }

  /* Compact Mobile Footer */
  .site-footer {
    margin-top: 2.25rem !important;
    padding: 2.25rem 0 1.25rem !important;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.35rem !important;
    margin-bottom: 1.5rem !important;
  }

  .footer-brand .brand-logo img {
    max-width: 135px !important;
    margin-bottom: 0.5rem;
  }

  .footer-brand p {
    font-size: 0.84rem !important;
    line-height: 1.55 !important;
    margin-top: 0.5rem !important;
    max-width: 100% !important;
  }

  .footer-brand .social-links {
    gap: 0.5rem !important;
    margin-top: 0.75rem !important;
  }

  .social-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .social-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  .footer-title {
    font-size: 0.98rem !important;
    margin-bottom: 0.65rem !important;
    padding-bottom: 0.4rem !important;
  }

  .footer-title::after {
    width: 22px !important;
    height: 1.5px !important;
  }

  /* Two-column compact grid for footer links to save vertical space */
  .footer-links {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem 1rem !important;
  }

  .footer-links li {
    margin-bottom: 0 !important;
  }

  .footer-links a {
    font-size: 0.84rem !important;
    padding: 0.15rem 0 !important;
    display: inline-block;
  }

  .footer-hours-item {
    font-size: 0.84rem !important;
    padding: 0.35rem 0 !important;
  }

  .site-footer p {
    font-size: 0.82rem !important;
    line-height: 1.55 !important;
    margin-bottom: 0.5rem !important;
  }

  .site-footer a[href^="tel:"] {
    font-size: 1.15rem !important;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.4rem !important;
    text-align: center;
    padding-top: 1rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    font-size: 0.76rem !important;
    line-height: 1.4 !important;
    color: var(--text-muted) !important;
  }

  /* Cart Drawer Full Width on Mobile */
  .cart-drawer {
    width: 100% !important;
    max-width: 100% !important;
    border-left: none;
  }

  /* Modals Full Responsive */
  .modal-overlay {
    padding: 1rem;
    align-items: flex-end;
  }

  .modal-box {
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-header {
    padding: 1.25rem 1.5rem;
  }

  .modal-body {
    padding: 1.25rem 1.5rem 2rem;
  }

  .prep-options-grid {
    grid-template-columns: 1fr !important;
  }

  /* Toast Notifications */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    max-width: 100%;
  }

  /* Seating Preference Cards in Reservation */
  .seating-card-label {
    padding: 1rem;
  }

  /* Floating WhatsApp offset */
  .floating-whatsapp-btn {
    bottom: 1.25rem;
    left: 1.25rem;
    width: 52px;
    height: 52px;
  }
}

/* ==========================================================================
   4. Small Mobile Phones (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Header Optimization for Compact Screens */
  .brand-logo img {
    max-width: 130px;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .nav-cta-btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
  }

  .nav-cta-btn span:first-child {
    display: none; /* Icon-only button on ultra small mobile to save space */
  }

  .cart-btn-trigger {
    width: 40px;
    height: 40px;
  }

  .mobile-toggle {
    padding: 6px;
  }

  .mobile-toggle span {
    width: 22px;
  }

  /* Hero Section */
  .hero-section {
    padding: 5.5rem 0 3rem;
  }

  .hero-title {
    font-size: 1.75rem !important;
  }

  .hero-direct-content p {
    font-size: 0.95rem !important;
  }

  /* Compact Hero Actions on Small Mobile */
  .hero-actions {
    max-width: 250px !important;
    gap: 0.45rem !important;
    margin-bottom: 1.15rem !important;
  }

  .hero-actions .btn,
  .hero-actions .hero-btn {
    padding: 0.52rem 0.85rem !important;
    font-size: 0.85rem !important;
    min-height: 38px !important;
  }

  /* Compact Hero Stats on Small Mobile */
  .hero-stats {
    max-width: 340px !important;
    padding-top: 0.9rem !important;
    gap: 0.25rem !important;
  }

  .hero-stat-num {
    font-size: 1.2rem !important;
  }

  .hero-stat-label {
    font-size: 0.66rem !important;
    line-height: 1.25 !important;
  }

  /* Dish Cards */
  .dish-media {
    height: 170px;
  }

  .dish-title {
    font-size: 1.1rem;
  }

  .dish-price {
    font-size: 1.15rem;
  }

  /* Contact Cards */
  .contact-channel-card {
    padding: 1.25rem;
  }

  /* Floating WhatsApp */
  .floating-whatsapp-btn {
    bottom: 1rem;
    left: 1rem;
    width: 48px;
    height: 48px;
  }
  .floating-whatsapp-btn svg {
    width: 24px;
    height: 24px;
  }

  /* Ultra-Compact Footer for Small Mobile Screens */
  .site-footer {
    margin-top: 1.75rem !important;
    padding: 1.75rem 0 1rem !important;
  }

  .footer-grid {
    gap: 1.15rem !important;
    margin-bottom: 1.25rem !important;
  }

  .footer-brand .brand-logo img {
    max-width: 120px !important;
  }

  .footer-brand p {
    font-size: 0.8rem !important;
  }

  .social-btn {
    width: 32px !important;
    height: 32px !important;
  }

  .social-btn svg {
    width: 14px !important;
    height: 14px !important;
  }

  .footer-title {
    font-size: 0.92rem !important;
    margin-bottom: 0.5rem !important;
  }

  .footer-links a {
    font-size: 0.8rem !important;
  }

  .footer-hours-item {
    font-size: 0.8rem !important;
  }

  .footer-bottom {
    font-size: 0.72rem !important;
  }
}

/* ==========================================================================
   5. Compact Ultra-Small Phones (<= 360px)
   ========================================================================== */
@media (max-width: 360px) {
  .brand-logo img {
    max-width: 110px;
  }

  .hero-actions {
    max-width: 230px !important;
    gap: 0.4rem !important;
  }

  .hero-actions .btn,
  .hero-actions .hero-btn {
    padding: 0.48rem 0.75rem !important;
    font-size: 0.8rem !important;
    min-height: 35px !important;
  }

  .hero-stats {
    max-width: 300px !important;
    padding-top: 0.8rem !important;
  }

  .hero-stat-num {
    font-size: 1.05rem !important;
  }

  .hero-stat-label {
    font-size: 0.6rem !important;
  }

  .hero-title {
    font-size: 1.55rem !important;
  }

  .section-title {
    font-size: 1.4rem !important;
  }

  .site-footer {
    margin-top: 1.5rem !important;
    padding: 1.5rem 0 0.85rem !important;
  }

  .footer-links {
    gap: 0.3rem 0.5rem !important;
  }

  .footer-links a {
    font-size: 0.76rem !important;
  }

  .footer-bottom {
    font-size: 0.68rem !important;
  }
}
