/* Mia Dolce Vita QR Menu - Premium Responsive Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@1,400;1,600&display=swap');

:root {
  --primary-color: #b4975a;      /* Elegant Gold/Bronze */
  --primary-dark: #8c7340;
  --secondary-color: #1e1e24;    /* Charcoal/Black */
  --bg-color: #f7f9fb;           /* Soft off-white */
  --card-bg: #ffffff;
  --text-main: #2b2b35;          /* Deep gray */
  --text-muted: #7c7c8c;
  --border-color: #eaecef;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --font-family: 'Plus Jakarta Sans', sans-serif;
  --font-serif: 'Playfair Display', serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

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

body {
  font-family: var(--font-family);
  background-color: #f0f2f5; /* Light desktop background */
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Responsive Main App Wrapper */
.app-wrapper {
  width: 100%;
  max-width: 1100px;
  margin: 40px auto;
  background-color: var(--bg-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 80vh;
}

.app-container {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Header Banner Section */
.header-banner {
  height: 280px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 32px 32px 32px;
  color: #ffffff;
  margin: 12px;
  border-radius: var(--border-radius-md);
}

.header-top-controls {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
  z-index: 10;
}

/* Language Switcher */
.lang-selector {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 3px;
  display: flex;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 15px;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn.active {
  background-color: #ffffff;
  color: var(--secondary-color);
  box-shadow: var(--shadow-sm);
}

/* Restaurant Profile overlapping header */
.restaurant-profile {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  transform: translateY(32px);
  z-index: 5;
  padding-left: 12px;
}

.logo-container {
  width: 100px;
  height: 100px;
  background-color: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: 4px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.logo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.restaurant-identity {
  margin-bottom: 8px;
  flex: 1;
}

.restaurant-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.restaurant-title-row h1 {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  letter-spacing: -0.5px;
}

.info-circle-btn {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
}

.info-circle-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.restaurant-subtitle {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  margin-top: 6px;
  max-width: 600px;
  line-height: 1.4;
}

/* Search Bar Section */
.search-section {
  padding: 48px 32px 20px 32px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  height: 52px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0 20px 0 48px;
  font-family: var(--font-family);
  font-size: 14.5px;
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(180, 151, 90, 0.12);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-action-btn {
  width: 52px;
  height: 52px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  color: var(--text-main);
  flex-shrink: 0;
}

.search-action-btn:hover {
  background-color: #fcfcfd;
}

/* Categories Slider & Row */
.categories-section {
  padding: 0 0 20px 0;
}

.categories-list {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 32px;
  justify-content: center; /* Center items on desktop */
}

.categories-list::-webkit-scrollbar {
  display: none;
}

.category-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.category-card-thumb {
  width: 80px;
  height: 64px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #eaecef;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  transition: var(--transition);
}

.category-card-thumb .emoji-icon {
  font-size: 26px;
}

.category-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  white-space: nowrap;
}

/* Active Category Styles */
.category-card.active {
  border-color: var(--primary-color);
  background-color: #fffaf0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(180, 151, 90, 0.15);
}

.category-card.active .category-card-thumb {
  transform: scale(1.04);
}

.category-card.active .category-card-label {
  color: var(--primary-dark);
}

/* Menu Content Section */
.menu-content-section {
  padding: 20px 32px 48px 32px;
  flex: 1;
}

/* Watermarked Header Group */
.category-header-group {
  position: relative;
  margin-bottom: 28px;
  height: 54px;
  display: flex;
  align-items: center;
}

.category-watermark {
  position: absolute;
  left: -5px;
  font-family: var(--font-serif);
  font-size: 52px;
  font-weight: 900;
  font-style: italic;
  color: rgba(0, 0, 0, 0.035);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  text-transform: lowercase;
  line-height: 1;
}

.active-category-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--secondary-color);
  position: relative;
  z-index: 2;
  letter-spacing: -0.5px;
}

/* Responsive Grid of Items */
.items-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns on large screens */
  gap: 20px;
}

.menu-item-card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.menu-item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(180, 151, 90, 0.2);
}

.menu-item-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 Aspect Ratio */
  background-color: #eaecef;
  overflow: hidden;
}

.menu-item-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item-card:hover .menu-item-image-wrapper img {
  transform: scale(1.06);
}

/* Badge Tags */
.menu-item-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 800;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.menu-item-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.menu-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary-color);
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.menu-item-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 32px;
}

.menu-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.menu-item-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary-dark);
}

.menu-item-btn {
  background-color: #f7f5f0;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--primary-dark);
  cursor: pointer;
  transition: var(--transition);
}

.menu-item-card:hover .menu-item-btn {
  background-color: var(--primary-color);
  color: #ffffff;
  transform: scale(1.1);
}

/* Empty Search Results */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 15px;
  color: var(--text-muted);
}

/* Modals System (Desktop Centered, Mobile Sheet) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(18, 18, 20, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center; /* Center on desktop */
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--card-bg);
  width: 100%;
  max-width: 480px; /* Center popup size */
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* Top close line handle */
.modal-close-bar {
  width: 40px;
  height: 5px;
  background-color: var(--border-color);
  border-radius: 10px;
  margin: -12px auto 20px auto;
  cursor: pointer;
}

/* Close button for desktop modal context */
.modal-content::after {
  content: '✕';
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #f3f5f8;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.modal-content:hover::after {
  background-color: #eaecef;
  color: var(--secondary-color);
}

/* Detailed Product Modal Info */
.details-image-container {
  width: 100%;
  padding-top: 60%;
  position: relative;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.details-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-header {
  margin-bottom: 14px;
}

.details-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary-color);
  margin-bottom: 6px;
}

.details-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.details-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.details-price-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.details-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Options / Variant selection */
.details-options {
  margin-bottom: 24px;
}

.options-header {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-md);
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.option-row:hover {
  background-color: #fcfcfd;
}

.option-row.selected {
  border-color: var(--primary-color);
  background-color: #fffaf0;
  color: var(--primary-dark);
}

.option-price {
  font-weight: 700;
}

/* Cafe Information Modal Details */
.info-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary-color);
  margin-bottom: 20px;
  text-align: center;
}

.info-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
}

.info-icon-box {
  width: 40px;
  height: 40px;
  background-color: #f7f5f0;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--primary-dark);
  flex-shrink: 0;
  font-size: 18px;
}

.info-details-box {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.info-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--secondary-color);
  line-height: 1.4;
}

/* Keyframes */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Adaptive Desktop to Mobile Breakpoints)
   ========================================================================== */

/* Tablet Viewports */
@media (max-width: 1024px) {
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .app-wrapper {
    margin: 20px;
  }
}

/* Mobile Viewports */
@media (max-width: 768px) {
  body {
    background-color: var(--bg-color); /* Matches app background on mobile */
    align-items: stretch;
    padding: 0;
  }

  .app-wrapper {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .header-banner {
    height: 230px;
    border-radius: 0;
    margin: 0;
    padding: 16px 20px 24px 20px;
  }

  .header-top-controls {
    top: 20px;
    right: 20px;
  }

  .restaurant-profile {
    gap: 16px;
    transform: translateY(20px);
    padding-left: 0;
  }

  .logo-container {
    width: 84px;
    height: 84px;
    border-radius: 20px;
  }

  .logo-container img {
    border-radius: 16px;
  }

  .restaurant-title-row h1 {
    font-size: 20px;
  }

  .restaurant-subtitle {
    font-size: 11.5px;
    margin-top: 4px;
  }

  .search-section {
    padding: 36px 20px 16px 20px;
    gap: 12px;
  }

  .search-input {
    height: 52px;
    padding-left: 44px;
  }

  .search-icon {
    left: 16px;
  }

  .search-action-btn {
    width: 52px;
    height: 52px;
  }

  .categories-list {
    padding: 4px 20px;
    justify-content: flex-start; /* Normal touch horizontal scrolling */
  }

  .category-card {
    min-width: 85px;
    padding: 8px;
  }

  .category-card-thumb {
    width: 68px;
    height: 54px;
  }

  .category-card-thumb .emoji-icon {
    font-size: 24px;
  }

  .menu-content-section {
    padding: 16px 20px;
  }

  /* Grid Layout becomes 2-column on mobile as requested */
  .items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .menu-item-info {
    padding: 12px;
  }

  .menu-item-title {
    font-size: 13px;
  }

  .menu-item-desc {
    font-size: 10.5px;
    height: 30px;
    margin-bottom: 12px;
  }

  .menu-item-price {
    font-size: 13.5px;
  }

  .menu-item-btn {
    width: 28px;
    height: 28px;
  }

  /* Modals slide-up bottom sheet behavior on mobile */
  .modal-overlay {
    align-items: flex-end; /* Drawer bottom align */
  }

  .modal-content {
    max-width: 100%;
    border-radius: 0;
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    transform: translateY(100%);
    max-height: 85%;
    padding: 24px 20px 48px 20px; /* Extra bottom padding for mobile safe area */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-content::after {
    display: none; /* Hide desktop close cross icon on mobile drawer */
  }
  
  .modal-close-bar {
    display: block; /* Show the close bar handle */
  }
}

/* Small Screens (e.g. iPhone SE) */
@media (max-width: 380px) {
  .items-grid {
    grid-template-columns: 1fr;
  }
}
