/* ============================================
   Shared Styles — Coffee Menu App
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #241B15;
  --paper: #FAF6EF;
  --paper-dim: #F0E9DC;
  --stone: #8A7A68;
  --line: #E4D9C6;
  --accent: #8B5A2B; /* overridden per-shop from Firestore primaryColor */
  --accent-ink: #FAF6EF;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

button, input, select {
  font-family: inherit;
  font-size: 1rem;
}

/* ---- Layout ---- */
.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.shop-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
}

.shop-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-dim);
  flex-shrink: 0;
}

.shop-name {
  font-size: 1.5rem;
}

.shop-meta {
  color: var(--stone);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* ---- Menu ---- */
.category-title {
  font-size: 1.05rem;
  color: var(--accent);
  margin: 36px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.item-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}

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

.item-photo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--paper-dim);
  flex-shrink: 0;
}

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

.item-name {
  font-weight: 500;
  font-size: 1rem;
}

.item-desc {
  color: var(--stone);
  font-size: 0.85rem;
  margin-top: 2px;
}

.item-price {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
}

.unavailable {
  opacity: 0.45;
}

.unavailable .item-price::after {
  content: " · غير متاح";
  font-family: 'Work Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
}

/* ---- Forms / Dashboard ---- */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--stone);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-block;
  padding: 11px 22px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
}

.btn:hover { opacity: 0.9; }

.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn-ghost {
  background: none;
  color: var(--stone);
  border: 1px solid var(--line);
}

.btn-danger {
  background: none;
  color: #B3441E;
  border: 1px solid #E4D9C6;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.state-msg {
  text-align: center;
  color: var(--stone);
  padding: 60px 20px;
}

.dashboard-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-item img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--paper-dim);
  flex-shrink: 0;
}

.dashboard-item .grow { flex: 1; min-width: 0; }

.error-msg {
  color: #B3441E;
  font-size: 0.9rem;
  margin-top: 10px;
}

@media (max-width: 480px) {
  .wrap { padding: 0 16px 48px; }
}

/* ---- Cart / Ordering (menu.html) ---- */
.qty-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: white;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.qty-btn:hover { border-color: var(--accent); color: var(--accent); }

.qty-count {
  min-width: 18px;
  text-align: center;
  font-weight: 500;
}

.cart-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 608px;
  margin: 0 auto;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 10;
}

.cart-bar span { font-weight: 500; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36,27,21,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal-sheet {
  background: var(--paper);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 24px 20px 32px;
}

.modal-sheet .close-x {
  float: left;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--stone);
}

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.cart-total-line {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.15rem;
}

.order-success {
  text-align: center;
  padding: 30px 10px;
}

.order-success .big-check {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---- Orders panel (dashboard.html) ---- */
.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: white;
}

.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.order-status {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}

.status-pending { background: #FBEBD0; color: #92600A; }
.status-preparing { background: #DCE8F5; color: #2A5C8A; }
.status-ready { background: #DEEFE1; color: #2E6B44; }

.order-items-line {
  font-size: 0.9rem;
  color: var(--stone);
  margin-bottom: 10px;
}

.order-actions {
  display: flex;
  gap: 8px;
}

/* ---- Notification bell ---- */
.bell-wrap {
  position: relative;
  font-size: 1.4rem;
  cursor: pointer;
}

.bell-badge {
  position: absolute;
  top: -6px;
  left: -10px;
  background: #C0392B;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: 'Work Sans', sans-serif;
}

@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-15deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(5deg); }
}

.bell-shake { animation: bellShake 0.6s ease; }

/* ---- Customer menu: full-bleed cover hero ---- */
.menu-hero {
  position: relative;
  margin: 0 -20px 4px;
  min-height: 220px;
  background-size: cover;
  background-position: center;
  background-color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px 30px;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
}

.menu-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,12,8,0.25) 0%, rgba(20,12,8,0.72) 100%);
}

.menu-hero > * {
  position: relative;
  z-index: 1;
}

.menu-hero-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  border: 3px solid white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  margin-bottom: 14px;
}

.menu-hero-name {
  color: white;
  font-size: 1.7rem;
}

.menu-hero-tagline {
  color: rgba(255,255,255,0.88);
  font-size: 0.88rem;
  margin-top: 6px;
}

.menu-hero-location {
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* ---- Sticky category pill nav ---- */
.category-pills {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 20px;
  margin: 0 -20px 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

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

.pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pill.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---- Menu grid (customer-facing item cards) ---- */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.grid-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.grid-card.unavailable { opacity: 0.5; }

.grid-card-img-wrap {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--paper-dim);
}

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

.grid-qty-container {
  position: absolute;
  bottom: -14px;
  inset-inline-end: 10px;
  z-index: 2;
}

.grid-add-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.22);
}

.grid-qty-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  border: 3px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.22);
  padding: 0 2px;
  white-space: nowrap;
}

.grid-qty-stepper button {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.grid-qty-stepper .grid-qty-num {
  min-width: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.grid-qty-badge {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  background: var(--ink);
  color: white;
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.grid-unavailable-tag {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 500;
}

.grid-card-body {
  padding: 10px 10px 12px;
}

.grid-card-name {
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.3;
  margin-bottom: 4px;
  min-height: 2.1em;
}

.grid-card-price {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---- Dashboard app shell: bottom nav + tabs ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--stone);
  font-family: inherit;
}

.nav-item .nav-icon { font-size: 1.3rem; }
.nav-item .nav-label { font-size: 0.68rem; }

.nav-item.active { color: var(--accent); }

.tab-view { display: none; }
.tab-view.active { display: block; }

/* ---- Inventory tab ---- */
.inventory-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.inventory-row .grow { flex: 1; }

.inventory-row input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.stock-low { color: #B3441E; font-size: 0.78rem; margin-top:2px; }

/* ---- Subscription status banners (owner dashboard) ---- */
.sub-banner {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.sub-banner-danger {
  background: #FBEAE5;
  color: #B3441E;
  border: 1px solid #E4B8AC;
}

.sub-banner-warning {
  background: #FDF3D9;
  color: #8A6414;
  border: 1px solid #E9D190;
}

/* ---- Language toggle (customer menu) ---- */
.lang-toggle {
  position: fixed;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 15;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  color: var(--ink);
}

/* ---- Order type toggle (car / table) ---- */
.order-type-toggle {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.order-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  color: var(--stone);
  font-family: inherit;
  font-size: 0.82rem;
}

.order-type-btn .order-type-icon { font-size: 1.5rem; }

.order-type-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, white);
  font-weight: 500;
}

/* ---- Sales tab ---- */
.range-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.range-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
}

.range-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.sales-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.sales-summary-box {
  flex: 1;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.sales-summary-box .big-num {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.4rem;
  display: block;
}

.sales-summary-box .label {
  color: var(--stone);
  font-size: 0.8rem;
}

.top-item-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

/* ---- Icon sub-nav inside "لوحة التحكم" tab ---- */
.icon-subnav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.icon-subnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--stone);
  font-family: inherit;
}

.icon-subnav-btn .icon-subnav-icon { font-size: 1.5rem; }
.icon-subnav-btn .icon-subnav-label { font-size: 0.75rem; }

.icon-subnav-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, white);
}

.sub-view { display: none; }
.sub-view.active { display: block; }

.dashboard-item.item-hidden {
  opacity: 0.5;
}

.icon-action-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
}

/* ---- Category suggestion chips ---- */
.category-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--stone);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}

.category-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cart-bar {
  bottom: calc(16px + env(safe-area-inset-bottom));
}

/* ---- Order status tracking (customer side) ---- */
.status-bar {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  max-width: 608px;
  margin: 0 auto;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 14px 22px;
  text-align: center;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 10;
}

.status-bar.status-bar-ready {
  background: var(--accent);
  color: var(--accent-ink);
}

.order-track {
  padding: 14px 4px 4px;
}

.timeline-bar {
  display: flex;
  gap: 4px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}

.timeline-segment {
  flex: 1;
  background: var(--line);
  transition: background 0.3s ease;
}

.timeline-segment.done {
  background: var(--accent);
}

.timeline-segment.active {
  background: var(--accent);
  opacity: 0.5;
}

.timeline-labels {
  display: flex;
  margin-top: 10px;
}

.timeline-labels span {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  color: var(--stone);
}

.timeline-labels span.done,
.timeline-labels span.active {
  color: var(--ink);
  font-weight: 500;
}
