/* ============================================================
   QR Menu Web App — Main Stylesheet
   Replicates the Flutter QR Menu visual design pixel-perfectly.
   ============================================================ */

/* ----------------------------------------------------------
   1. GLOBAL RESET & BASE
   ---------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: rgb(12, 12, 12);
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  color: white;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

#app {
  position: relative;
}

/* Hide all scrollbars globally */
::-webkit-scrollbar {
  display: none;
}

html {
  scrollbar-width: none;
  scroll-behavior: smooth;
}

/* ----------------------------------------------------------
   2. SPINNER (translation toast)
   ---------------------------------------------------------- */
@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ----------------------------------------------------------
   3. VENUE HEADER
   ---------------------------------------------------------- */
#venue-header {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

#venue-header-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.5);
}

#venue-header-gradient {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(12, 12, 12, 0.3) 30%,
    rgba(12, 12, 12, 0.6) 70%,
    rgb(12, 12, 12) 100%
  );
}

#venue-header-content {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  text-align: center;
  pointer-events: none;
  padding: 44px 48px 0;
}

#venue-name {
  font-size: var(--fs-title, 22px);
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1.3;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#venue-subtitle {
  font-size: var(--fs-subtitle, 24px);
  line-height: 1.25;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 20px;
}

#venue-header.no-subtitle #venue-subtitle {
  margin-top: 0;
}

/* ----------------------------------------------------------
   4. TOP ACTION BUTTONS
   ---------------------------------------------------------- */
.top-action-btn {
  position: absolute;
  top: 10px;
  z-index: 100;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.top-action-btn:active {
  transform: scale(0.94);
}

.top-action-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

#venue-info-btn {
  left: 16px;
}

#language-btn {
  right: 16px;
}

#language-btn.is-translating {
  background: rgba(255, 255, 255, 0.08);
  animation: translatePulse 1.6s ease-in-out infinite;
}

#language-btn.is-translating .material-icons-outlined {
  animation: spin 1.1s linear infinite;
}

@keyframes translatePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}

.top-action-btn .material-icons-outlined {
  font-size: 20px;
}

/* ----------------------------------------------------------
   5. MAIN CONTENT
   ---------------------------------------------------------- */
#main-content {
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------------------
   6. CATEGORY FILTER
   ---------------------------------------------------------- */
#category-filter {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 12px 48px 16px;
}

#category-filter-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  height: 100%;
  align-items: stretch;
  scrollbar-width: none;
}

#category-filter-list::-webkit-scrollbar {
  display: none;
}

.category-item {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(12, 12, 12, 0.7);
  font-size: var(--fs-categories, 13px);
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-item.selected {
  border-width: 2px;
  font-weight: bold;
  border-color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 20%, transparent);
  color: var(--cat-color);
}

#campaign-slider {
  margin: 16px 0;
  padding: 0 48px;
  --track-inner-space: 32px;
  --card-width: calc(100% - (var(--track-inner-space) * 2));
  --card-max: 400px;
}

#campaign-slider.single-campaign #campaign-track {
  padding: 0;
}

#campaign-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

#campaign-track::-webkit-scrollbar {
  display: none;
}

.campaign-card {
  width: var(--card-width);
  max-width: var(--card-max);
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  scroll-snap-align: center;
  cursor: default;
}

.single-campaign .campaign-card {
  width: 100%;
  max-width: unset;
}

.campaign-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.65);
}

.campaign-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

.campaign-card-content {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
}

.campaign-card-title {
  color: white;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.campaign-card-subtitle {
  color: rgba(255, 255, 255, 0.87);
  font-size: 13px;
  line-height: 1.3;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ----------------------------------------------------------
   8. CATEGORY GRID (Theme 0)
   ---------------------------------------------------------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 48px;
}

.category-card {
  padding: 16px;
  border: 2px solid var(--cat-color);
  border-radius: 8px;
  margin-top: 5px;
  overflow: hidden;
}

.category-card-title {
  font-size: var(--fs-category-name, 20px);
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--cat-color);
}

.menu-item-list {
  margin-top: 16px;
}

.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.menu-item-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.menu-item-name {
  color: white;
  font-size: var(--fs-item-title, 15px);
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.menu-item-size {
  color: rgba(255, 255, 255, 0.54);
  font-size: var(--fs-item-description, 12px);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.menu-item-price {
  color: white;
  font-size: var(--fs-item-price, 16px);
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 1px;
}

.menu-item-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.24);
  margin: 16px 0;
}

/* ----------------------------------------------------------
   9. ALLERGEN ICONS
   ---------------------------------------------------------- */
.allergen-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.allergen-icon {
  width: 18px;
  height: 18px;
  cursor: pointer;
  padding: 2px;
  filter: brightness(0) invert(0.7);
  transition: opacity 0.2s;
}

.allergen-icon:hover {
  opacity: 0.8;
}

/* ----------------------------------------------------------
   10. IMAGE CATEGORY LIST (Theme 1)
   ---------------------------------------------------------- */
.image-category-list {
  padding: 0 32px;
}

.image-category-section {
  margin-bottom: 24px;
}

.image-category-title {
  font-size: var(--fs-category-name, 20px);
  font-weight: bold;
  letter-spacing: 1px;
  padding: 5px 0;
}

.image-menu-items {
  margin-top: 12px;
}

.image-menu-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 0;
  gap: 16px;
}

.image-menu-item-thumb {
  width: 112px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

.image-menu-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.24);
}

.placeholder-icon .material-icons-outlined {
  font-size: 28px;
}

.image-item-divider {
  height: 0;
  margin: 2px 0;
}

/* ----------------------------------------------------------
   11. MODAL OVERLAY
   ---------------------------------------------------------- */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.28s ease;
}

#modal-overlay.visible {
  opacity: 1;
}

#modal-content {
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

#modal-content > * {
  pointer-events: auto;
}

body.modal-open {
  overflow: hidden;
}

body.is-translating #main-content {
  opacity: 0.97;
  transition: opacity 0.3s ease;
}

/* ----------------------------------------------------------
   11b. TRANSLATION TOAST
   ---------------------------------------------------------- */
#translation-toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(24, 24, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#translation-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.translation-toast-icon {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.75);
  animation: spin 1.2s linear infinite;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----------------------------------------------------------
   12. VENUE INFO DIALOG
   ---------------------------------------------------------- */
.venue-info-dialog {
  width: 420px;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 20px;
  background: linear-gradient(135deg, rgb(30, 30, 35), rgb(18, 18, 22));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dialog-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.dialog-title {
  color: white;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.5px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 12px;
  transition: background 0.2s;
}

.dialog-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dialog-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.info-item {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.info-item.clickable {
  cursor: pointer;
  transition: background 0.2s;
}

.info-item.clickable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.info-icon {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.54);
  flex-shrink: 0;
  line-height: 1.4;
}

.info-item.clickable .info-icon {
  color: rgb(144, 202, 249);
}

.info-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  letter-spacing: 0.3px;
  flex: 1;
  line-height: 1.4;
}

.info-item.clickable .info-text {
  color: white;
  font-weight: 500;
}

.info-arrow {
  color: rgb(144, 202, 249);
  font-size: 16px;
  flex-shrink: 0;
}

/* Social Media Section */
.social-media-section {
  margin-top: 8px;
}

.social-media-label {
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.social-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.social-media-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1.5px solid color-mix(in srgb, var(--sm-color) 60%, transparent);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--sm-color) 25%, transparent),
    color-mix(in srgb, var(--sm-color) 8%, transparent)
  );
  box-shadow: 0 0 8px color-mix(in srgb, var(--sm-color) 10%, transparent);
}

.social-media-btn:hover {
  transform: scale(1.05);
}

.social-media-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.branding-footer {
  margin-top: 32px;
  text-align: right;
  font-size: 13px;
}

.branding-footer a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.branding-footer a:hover {
  opacity: 1;
}

.social-media-btn .material-icons-outlined {
  font-size: 24px;
}

/* ----------------------------------------------------------
   13. LANGUAGE DIALOG
   ---------------------------------------------------------- */
.language-dialog {
  width: 360px;
  max-width: 100%;
  border-radius: 16px;
  background: rgb(20, 20, 20);
  overflow: hidden;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

.language-dialog .dialog-body {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

.language-item {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  color: white;
  font-size: 15px;
}

.language-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.language-item.selected {
  font-weight: bold;
}

.lang-check {
  color: #4CAF50;
  font-size: 20px;
}

/* ----------------------------------------------------------
   14. ALLERGEN DIALOG
   ---------------------------------------------------------- */
.allergen-dialog {
  width: 360px;
  max-width: 100%;
  border-radius: 16px;
  background: rgb(20, 20, 20);
  overflow: hidden;
}

.allergen-dialog .dialog-header {
  padding: 20px 24px;
}

.allergen-dialog .dialog-body {
  padding: 0 24px 12px;
}

.allergen-section-title {
  color: white;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
  margin-top: 8px;
}

.allergen-dialog-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.allergen-dialog-icon {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(0.7);
}

.allergen-dialog-item span {
  color: white;
  font-size: 14px;
}

.dialog-footer {
  padding: 12px 24px;
  display: flex;
  justify-content: flex-end;
}

.dialog-action-btn {
  background: transparent;
  border: none;
  color: #2196F3;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  font-family: inherit;
  transition: opacity 0.2s;
}

.dialog-action-btn:hover {
  opacity: 0.8;
}

/* ----------------------------------------------------------
   15. IMAGE LIGHTBOX
   ---------------------------------------------------------- */
.image-lightbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 90vh;
}

.image-lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.image-lightbox-close:hover {
  background: rgba(0, 0, 0, 0.75);
}

.image-lightbox-close .material-icons-outlined {
  font-size: 24px;
}

.image-lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* ----------------------------------------------------------
   16. TEMPLATE VIEW
   ---------------------------------------------------------- */
#template-view {
  background: rgb(12, 12, 12);
  min-height: 100vh;
}

#template-image {
  width: 100%;
  display: block;
}

/* ----------------------------------------------------------
   17. BOTTOM SPACER
   ---------------------------------------------------------- */
.bottom-spacer {
  height: 120px;
}

/* ----------------------------------------------------------
   18. TEXT CLAMP UTILITIES
   ---------------------------------------------------------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ----------------------------------------------------------
   19. RESPONSIVE — MOBILE (max-width: 600px)
   ---------------------------------------------------------- */
@media (max-width: 600px) {
  #venue-header-content {
    padding: 40px 16px 0;
  }

  #venue-name {
    font-size: var(--fs-title, 18px);
    max-width: 300px;
  }

  #venue-subtitle {
    font-size: var(--fs-subtitle, 20px);
    margin-top: 3px;
  }

  /* Category Filter */
  #category-filter {
    min-height: 35px;
    padding: 10px 16px 12px;
  }

  .category-item {
    padding: 6px 12px;
    font-size: var(--fs-categories, 11px);
  }

  /* Campaign Slider */
  #campaign-slider {
    padding: 0 16px;
    --track-inner-space: 24px;
  }

  .campaign-card {
    height: 144px;
  }

  /* Category Grid (Theme 0) */
  .category-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 16px;
  }

  .category-card {
    padding: 10px;
    border-width: 1.5px;
  }

  .category-card-title {
    font-size: var(--fs-category-name, 16px);
  }

  .menu-item-list {
    margin-top: 10px;
  }

  .menu-item {
    gap: 8px;
  }

  .menu-item-name {
    font-size: var(--fs-item-title, 14px);
  }

  .menu-item-size {
    font-size: var(--fs-item-description, 10px);
    margin-top: 1px;
  }

  .menu-item-price {
    font-size: var(--fs-item-price, 14px);
  }

  .menu-item-divider {
    height: 0.5px;
    margin: 10px 0;
  }

  /* Allergen Icons */
  .allergen-icons {
    margin-top: 4px;
  }

  .allergen-icon {
    width: 16px;
    height: 16px;
  }

  /* Image Category List (Theme 1) */
  .image-category-list {
    padding: 0 16px;
  }

  .image-category-section {
    margin-bottom: 16px;
  }

  .image-category-title {
    font-size: var(--fs-category-name, 16px);
    padding: 5px 0;
  }

  .image-menu-items {
    margin-top: 8px;
  }

  .image-menu-item {
    padding: 8px 0;
    gap: 12px;
  }

  .image-menu-item-thumb {
    width: 80px;
    height: 60px;
  }

  /* Venue Info Dialog */
  .venue-info-dialog {
    width: 100%;
  }
}
