/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #352315;
  --bg-dark: #241810;
  --bg-card: #4a3220;
  --bg-card-hover: #5c3f28;
  --accent: #c8860a;
  --accent-light: #e8a82a;
  --accent-glow: #f5c842;
  --text: #f5e6d0;
  --text-muted: #b89a78;
  --text-dim: #8a6a4a;
  --border: #5a3e28;
  --product-bg: #3e2918;
  --product-border: #6b4a2e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.45);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.35);
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* ===== PAGES ===== */
.page {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}
.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER / LOGO ===== */
header {
  background: linear-gradient(160deg, #1e1108 0%, #2c1c0e 50%, #4a3220 100%);
  padding: 22px 20px 20px;
  border-bottom: 2px solid var(--accent);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 320px; height: 200px;
  background: radial-gradient(ellipse, rgba(200,134,10,0.10) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.logo-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(200,134,10,0.2), 0 6px 24px rgba(0,0,0,0.55);
  background: #1e1108;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cafe-name-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cafe-name {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--accent-glow);
  text-shadow: 0 2px 14px rgba(200,134,10,0.45);
  text-transform: uppercase;
  line-height: 1.1;
}

.cafe-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-top: 1px solid rgba(200,134,10,0.3);
  padding-top: 4px;
  margin-top: 2px;
}

/* ===== CART BUTTON ===== */
.cart-btn {
  background: rgba(200,134,10,0.15);
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cart-btn:active,
.cart-btn:hover {
  background: rgba(200,134,10,0.28);
  transform: scale(1.07);
}

.cart-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
}

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #e8350a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
  line-height: 1;
  transition: transform 0.2s ease;
}

.cart-badge.pop {
  transform: scale(1.4);
}

/* ===== CART OVERLAY ===== */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.cart-overlay.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ===== CART DRAWER ===== */
.cart-drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  background: #241810;
  border-top: 2px solid var(--accent);
  border-radius: 22px 22px 0 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
}

.cart-drawer.open {
  transform: translateX(-50%) translateY(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-drawer-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-glow);
  letter-spacing: 0.5px;
}

.cart-close-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.cart-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.cart-empty-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
  opacity: 0.5;
}

.cart-item {
  background: var(--product-bg);
  border: 1px solid var(--product-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease both;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.78rem;
  color: var(--accent-light);
  margin-top: 2px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qty-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-light);
  font-size: 1rem;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  flex-shrink: 0;
}

.qty-btn:hover {
  background: var(--bg-card-hover);
}

.qty-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #e8350a;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.12s;
  flex-shrink: 0;
}

.cart-item-remove:hover {
  background: rgba(232,53,10,0.12);
}

/* ===== CART FOOTER ===== */
.cart-footer {
  padding: 14px 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cart-total-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--accent-glow);
}

.cart-order-btn {
  background: rgba(232,53,10,0.12);
  border: 1px solid rgba(232,53,10,0.35);
  color: #ff6b4a;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.5px;
}

.cart-order-btn:hover {
  background: rgba(232,53,10,0.22);
}

/* ===== ADD TO CART BUTTON (product card) ===== */
.product-card {
  flex-wrap: nowrap;
}

.add-to-cart-btn {
  background: rgba(200,134,10,0.15);
  border: 1.5px solid var(--accent);
  color: var(--accent-light);
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.add-to-cart-btn:active,
.add-to-cart-btn:hover {
  background: rgba(200,134,10,0.32);
  transform: scale(1.12);
}

.add-to-cart-btn.added {
  background: rgba(200,134,10,0.35);
  border-color: var(--accent-glow);
}

/* ===== CATEGORIES GRID ===== */
.categories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 16px 32px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.category-card:active,
.category-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 24px rgba(200,134,10,0.2), var(--shadow-card);
}

.cat-icon {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.category-card span {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  letter-spacing: 0.3px;
  line-height: 1.3;
}

/* ===== CATEGORY PAGE HEADER ===== */
.cat-header {
  background: linear-gradient(160deg, #1e1108 0%, #352315 100%);
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-light);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.back-btn:active,
.back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.cat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.cat-header-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

#cat-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-glow);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== PRODUCTS LIST ===== */
.products-list {
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  background: var(--product-bg);
  border: 1px solid var(--product-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.25s ease both;
}

.product-card:nth-child(1) { animation-delay: 0.04s; }
.product-card:nth-child(2) { animation-delay: 0.08s; }
.product-card:nth-child(3) { animation-delay: 0.12s; }
.product-card:nth-child(4) { animation-delay: 0.16s; }
.product-card:nth-child(5) { animation-delay: 0.20s; }
.product-card:nth-child(6) { animation-delay: 0.24s; }
.product-card:nth-child(7) { animation-delay: 0.28s; }
.product-card:nth-child(8) { animation-delay: 0.32s; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.product-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.product-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-light);
  white-space: nowrap;
  background: rgba(200,134,10,0.12);
  border: 1px solid rgba(200,134,10,0.25);
  border-radius: 8px;
  padding: 5px 10px;
}

/* ===== CATEGORY DESCRIPTION BANNER ===== */
.cat-banner {
  margin: 0 16px 4px;
  padding: 12px 14px;
  background: rgba(200,134,10,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== PRODUCT MODAL ===== */
.product-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 400;
  backdrop-filter: blur(3px);
}

.product-modal-overlay.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.product-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  background: #1e1108;
  border-top: 2px solid var(--accent);
  border-radius: 24px 24px 0 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: transform 0.34s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -10px 50px rgba(0,0,0,0.7);
  overflow: hidden;
}

.product-modal.open {
  transform: translateX(-50%) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}

.modal-close-btn:hover {
  background: rgba(0,0,0,0.7);
  color: var(--text);
}

.modal-img-wrap {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: #2c1c0e;
}

.modal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-img.hidden {
  display: none;
}

.modal-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  background: linear-gradient(135deg, #2c1c0e, #4a3220);
}

.modal-img-placeholder.hidden {
  display: none;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.modal-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.ingredient-tag {
  background: rgba(200,134,10,0.12);
  border: 1px solid rgba(200,134,10,0.25);
  color: var(--accent-light);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.modal-price {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent-glow);
}

.modal-add-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), #a06808);
  border: none;
  color: #1e1108;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
}

.modal-add-btn:active,
.modal-add-btn:hover {
  opacity: 0.88;
  transform: scale(1.02);
}

.modal-add-btn.added {
  background: linear-gradient(135deg, #2e8b2e, #1a5c1a);
  color: #fff;
}

/* ===== DESKTOP SCALING ===== */
@media (min-width: 480px) {
  body {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0,0,0,0.6);
  }
}

@media (min-width: 768px) {
  body { max-width: 520px; }
  .categories-grid { grid-template-columns: 1fr 1fr 1fr; }
  .category-card { padding: 26px 14px 20px; }
  .cat-icon { font-size: 2.6rem; }
  .category-card span { font-size: 0.88rem; }
}
