/* Apple-style UI for CBK Ordering System */
:root {
  --bg: #F5F5F7;
  --text: #1C1C1E;
  --muted: #6e6e73;
  --primary: #347AF0;
  --accent: #5856D6;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(0,0,0,0.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Inter", "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.5; }

.app-header { position: sticky; top:0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; box-shadow: var(--shadow); }
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.nav { display: flex; gap: 12px; align-items: center; }
.nav-link { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); transition: transform .1s ease, background .2s ease; }
.nav-link:hover { background: #f0f0f0; }
.nav-link:active { transform: scale(0.95); }
.nav-user { color: var(--muted); font-size: 14px; }

.container { max-width: 1040px; padding: 16px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }

.btn { display: inline-block; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); padding: 10px 16px; cursor: pointer; text-decoration: none; transition: transform .1s ease, filter .2s ease; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.95); }
.btn-muted { background: #e4e4e7; color: #111; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: var(--radius); background: #fff; }
.label { font-size: 14px; color: var(--muted); }

.app-footer { text-align: center; padding: 24px; color: var(--muted); }

/* Food image */
.food-img { width: 300px; height: 300px; border-radius: var(--radius); object-fit: cover; display: block; }
.food-card { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: center; }
.food-name { font-weight: 600; font-size: 18px; }
.food-desc { color: var(--muted); font-size: 14px; }
.price { font-weight: 600; color: var(--accent); }
.stock-soldout { color: #d32f2f; font-weight: 600; }

/* Animations */
.fade-in { animation: fadeIn .3s ease-out; }
@keyframes fadeIn { from{ opacity: 0; } to { opacity: 1; } }

.slide-left-enter { animation: slideLeft .3s ease-out; }
@keyframes slideLeft { from { transform: translateX(12px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* Add-to-cart flying effect hook */
.fly { position: fixed; z-index: 9999; width: 60px; height: 60px; border-radius: 50%; pointer-events: none; box-shadow: var(--shadow); overflow: hidden; }

/* Responsive */
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Fixed bottom bar on mobile */
.fixed-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; box-shadow: var(--shadow); padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

/* ===== Mobile bottom navigation ===== */
.mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: #fff; border-top: 1px solid #eee; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.mobile-nav__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 12px; padding: 6px 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.mobile-nav__item:hover { background: #f7f7f9; }
.mobile-nav__item:active, .mobile-nav__item.pressed { background: #f0f4ff; }
.mobile-nav__item.is-active { color: var(--primary); }
.mobile-nav__icon { width: 22px; height: 22px; fill: currentColor; }
.mobile-nav__label { line-height: 1; }

/* Hide top nav on small screens and reserve space for bottom nav */
@media (max-width: 768px) {
  .app-header .nav { display: none; }
  .container { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ===== Mobile card & grid optimization ===== */
/* Improve tap targets and responsive card layout */
.btn { min-height: 44px; -webkit-tap-highlight-color: rgba(52,122,240,0.12); touch-action: manipulation; }
.btn.pressed { transform: scale(0.98); }

.card img { width: 100%; height: auto; border-radius: 8px; }

@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; gap: 12px; }
  .card { padding: 12px; }
  .food-img { width: 100%; height: auto; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr !important; }
}

/* ===== Accessibility: focus styles & contrast ===== */
.nav-link, .btn, .mobile-nav__item { outline: none; }
.nav-link:focus-visible, .btn:focus-visible, .mobile-nav__item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Ensure readable contrast for muted text on white */
:root { --muted: #5a5a5f; }

/* Small brand badge at top-left */
.brand-badge {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.brand-badge:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
@media (prefers-color-scheme: light) {
  .brand-badge {
    background: #fff;
    color: #111;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    border: 1px solid rgba(0,0,0,0.08);
  }
}
/* Avoid overlap between brand badge and content */
@media (max-width: 1024px) {
  .container {
    padding-top: 48px;
  }
}