/* index.css styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  font-family: 'Noto Sans Khmer', system-ui, -apple-system, sans-serif;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

#root {
  width: 100%;
  min-height: 100dvh;
}

input,
button {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

img {
  display: block;
  max-width: 100%;
}

/* App.css styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Khmer:wght@400;500;600;700&display=swap');

:root {
  --theme-bg: #ffffff;
  --page-bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f0fdf4;
  --primary: #16a34a;
  --secondary: #15803d;
  --primary-soft: #dcfce7;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

.app {
  min-height: 100dvh;
  background: var(--page-bg);
  font-family: 'Noto Sans Khmer', system-ui, -apple-system, sans-serif;
}

.menu-app {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--page-bg);
  display: flex;
  flex-direction: column;
  font-family: inherit;
  position: relative;
}

@media (min-width: 768px) {
  .menu-app::before {
    content: '';
    position: fixed;
    inset: 0;
    background: #0f172a;
    z-index: -2;
  }

  .menu-app {
    max-width: 430px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 1;
  }
}

/* Header */
.menu-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  padding: calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left));
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--primary-soft);
  flex-shrink: 0;
}

.brand-logo-fallback {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: 0;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lang-switch {
  display: flex;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 40px;
  text-decoration: none;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Category scroll */
.category-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 0 10px;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-chip:active {
  transform: scale(0.95);
}

.category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  min-height: 42px;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-light);
  flex-shrink: 0;
}

.search-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.92rem;
  color: var(--text);
  min-width: 0;
}

.search-field::placeholder {
  color: var(--text-light);
}

.search-field::-webkit-search-cancel-button,
.search-field::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
}

.search-clear {
  background: var(--border);
  border: none;
  color: var(--text-light);
  font-size: 0.65rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Body */
.menu-body {
  flex: 1;
  padding: 10px calc(10px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(10px + var(--safe-left));
}

.product-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.product-section-header h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.02em;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.product-count {
  font-size: 0.76rem;
  color: #fff;
  background: var(--primary);
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.product-card:active {
  transform: scale(0.97);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.product-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-muted);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.product-info {
  padding: 7px 6px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.product-info h3 {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.product-price {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

/* Product detail bottom sheet */
.bottom-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.45);
  animation: sheetBackdropIn 0.25s ease forwards;
  cursor: pointer;
}

.bottom-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.14);
  animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) forwards;
  padding-bottom: var(--safe-bottom);
}

.bottom-sheet::-webkit-scrollbar {
  display: none;
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  margin: 10px auto 8px;
  border-radius: 999px;
  background: var(--border);
}

.bottom-sheet-image {
  width: 100%;
  height: 260px;
  max-height: 35vh;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bottom-sheet-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bottom-sheet-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 3rem;
  font-weight: 700;
}

.bottom-sheet-body {
  padding: 16px 16px 12px;
}

.bottom-sheet-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.bottom-sheet-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
  word-break: break-word;
}

.bottom-sheet-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
}

.bottom-sheet-section h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bottom-sheet-description {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.bottom-sheet-close-btn {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.bottom-sheet-close-btn:active {
  transform: scale(0.98);
}

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

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 768px) {
  .bottom-sheet {
    width: 100%;
    max-width: 430px;
    max-height: 82dvh;
    border-radius: 18px 18px 0 0;
  }
}

/* Skeleton */
.skeleton-card {
  aspect-ratio: 0.72;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-muted) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
  border: none;
}

.category-chip.skeleton {
  width: 56px;
  color: transparent;
  background: var(--border);
  border-color: var(--border);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.empty-reset {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

/* Footer */
.menu-footer {
  text-align: center;
  padding: 14px calc(12px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(12px + var(--safe-left));
  color: var(--text-light);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.footer-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.footer-text {
  font-size: 0.72rem;
  line-height: 1.5;
  margin-bottom: 2px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}

.social-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.social-icon-btn:active {
  transform: scale(0.94);
}

.social-icon-btn svg {
  width: 22px;
  height: 22px;
}

.social-telegram {
  background: #0088cc;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.35);
}

.social-facebook {
  background: #1877f2;
  color: #fff;
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.35);
}

@media (max-width: 340px) {
  .product-grid {
    gap: 5px;
  }

  .product-info h3 {
    font-size: 0.72rem;
  }

  .product-price {
    font-size: 0.76rem;
  }
}
