/* ...existing styles... */
:root{
  --bg: #0b0b0f;
  --bg2: #121218;
  --fg: #fff;
  --muted: #b8bcc6;
  --accent: #1e1e26;
  --btn-bg: #1a1f2a;
  --btn-hover: #222936;
  --surface: #11141b;
  font-family: "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* Progress color control (toggle in settings via body[data-progress="white"]) */
:root { --progress-gradient: linear-gradient(180deg,#fff,#cfcfcf); }
body[data-progress="white"] { --progress-gradient: linear-gradient(180deg,#ffffff,#ffffff); }

/* Main menu stacking entrance animation */
.menu-list .menu-item .big-btn.menu-appear {
  opacity: 0;
  transform: none;
}
.menu-list .menu-item .big-btn.menu-animate {
  animation: menu-fade-in 260ms ease forwards;
}
@keyframes menu-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.app-header.hidden {
  display: none !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .menu-list .menu-item .big-btn.menu-animate { animation: none; opacity: 1; transform: none; }
}

html,body,#app{
  height:100%;
  margin:0;
  overflow-x: hidden;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(6,8,12,0.64) 0%, rgba(6,8,12,0.64) 100%);
  color:var(--fg);
  animation: none;
}

.app-header{
  padding:16px;
  border-bottom:1px solid #111;
  background: rgba(10,12,18,0.6);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}

h1{
  margin:0 0 6px 0;
  font-size:20px;
  font-weight:700;
}

.subtitle{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.black-screen{
  padding:12px;
  min-height:60vh;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.controls{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:space-between;
}

/* Main menu list styling: modern card-like buttons with circular initial badge */
.menu-list {
  list-style: none;
  padding: 8px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  width:100%;
}
.menu-item { margin:0; }

.big-btn{
  color: var(--fg); /* Ensure base button text is white */
  box-shadow: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  transition: background .12s ease, transform .08s ease;
}
.big-btn * {
  color: inherit; /* Ensure children inherit white color by default */
}
/* Except muted text, which should still be readable */
.big-btn .muted {
  color: var(--muted);
}

/* badge (initial letter) — for RTL we place it visually on the right */
.menu-badge{
  display:none;
  /* removed decorative badge to simplify main menu buttons */
}

/* label styling: title + muted subtitle if needed (keeps existing muted class) */
.menu-label{
  display:block;
  font-weight:700;
  font-size:16px;
  color:var(--fg);
}

/* subtle hover/active feel */
.big-btn:hover{
  box-shadow: none;
  background: rgba(255,255,255,0.03);
}

/* tiny press feedback that doesn't lift the button */
.big-btn:active{
  transform: scale(0.998);
  box-shadow: 0 10px 22px rgba(0,0,0,0.42), inset 0 -1px 6px rgba(0,0,0,0.18);
}

/* ensure RTL feel: badge on the right visually for Arabic */
[dir="rtl"] .big-btn { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .menu-badge { margin-left: 8px; margin-right: 0; }
[dir="ltr"] .menu-badge { margin-right: 8px; }

.big-btn .ripple{
  position:absolute; border-radius:50%; transform:scale(0);
  background: rgba(255,255,255,0.18); animation:ripple .5s ease-out; pointer-events:none;
}

@keyframes ripple{ to{ transform:scale(12); opacity:0; } }

/* keep mobile friendly sizing */
@media (max-width:420px){
  .menu-badge{ width:44px; height:44px; font-size:16px; }
  .big-btn{ padding:16px; font-size:18px; }
  /* ensure the main menu becomes a single column on narrow screens to avoid horizontal scrolling */
  .menu-list { grid-template-columns: 1fr; padding: 8px; }
  .big-btn { width:100%; justify-content: space-between; }
}

/* footer/status */
.app-footer{
  padding:12px;
  border-top:1px solid #111;
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  font-size:14px;
  color:var(--muted);
  background: rgba(10,12,18,0.6);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}

/* Mobile friendliness */
@media (max-width:420px){
  .big-btn{ padding:16px; font-size:18px; }
}

.section-header { 
  display:flex; 
  align-items:center; 
  justify-content:center; /* Center the title content horizontally */
  gap:8px; 
  position:relative; 
  min-height: 38px; /* Ensure space for vertical centering */
}
.section-title { 
  margin:0; 
  font-size:16px; 
  font-weight:700; 
  /* Increased padding from 56px to 64px to ensure clearance for back button */
  padding-inline-start: 64px; 
  padding-inline-end: 64px; 
  text-align: center;
}
.section-header .back-btn { 
  position:absolute; 
  /* Use logical inset-inline-start */
  inset-inline-start: 8px;    
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 8px;
  font-size: 13px;
  min-width: auto;
  border-radius: 8px;
  z-index: 10;
  /* Ensure it doesn't take up space on the end side */
  inset-inline-end: auto;
  
  /* Make invisible but accessible */
  opacity: 0;
  pointer-events: all; /* Ensure it is still clickable */
}
/* Explicitly remove old LTR/RTL overrides if present, relying on logical properties */
[dir="rtl"] .section-header .back-btn { left: auto; right: auto; }
[dir="ltr"] .section-header .back-btn { left: auto; right: auto; }

.section-panel {
  max-height: calc(100vh - 120px);
  display:flex;
  flex-direction:column;
  gap:8px;
  border-radius: 12px;
  padding: 8px;
  width: calc(100% - 24px);
  max-width: 980px;
  margin: 8px auto;
  box-sizing: border-box;
}
.section-body {
  overflow:auto;
  padding:8px 6px;
  overflow-x: hidden; /* prevent horizontal overflow */
}
/* when a section-panel hosts the fixed store cashier, add extra bottom padding so content isn't overlapped */
.section-panel.has-store-cashier .section-body {
  padding-bottom: 96px; /* enough space for the fixed cashier + comfortable gap on mobile */
}
/* make the cashier or fixed items not push content horizontally on small screens */
.store-cashier { left:8px; right:8px; bottom:8px; }

/* grid for buttons */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap:10px;
}

.store-grid { 
  display:grid; 
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); 
  gap:10px; 
}
.store-card {
  background:#0a0a0a; 
  border:1px solid #111; 
  padding:10px; 
  border-radius:8px; 
  display:flex; 
  flex-direction:column; 
  gap:8px;
  background: rgba(20,22,30,0.7);
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 2px 14px rgba(0,0,0,0.35);
}
.store-card.selected { 
  outline:2px solid #6b6b6b; 
  box-shadow: 0 0 0 3px rgba(255,255,255,0.02); 
}
.select-btn {
  padding:8px 10px;
  font-size:14px;
  flex: 0 0 auto;
  min-width:84px;
}
.store-card .card-head { 
  display:flex; 
  justify-content:space-between; 
  align-items:center; 
  gap:8px; 
}
.qty-controls { 
  display:flex; 
  gap:8px; 
  align-items:center; 
  justify-content:flex-end; 
}
.qty-controls button { 
  padding:6px 8px; 
  min-width:36px; 
  font-size:14px; 
}
/* cashier bar (bottom of the panel) */
.cashier-bar { 
  position:sticky; 
  bottom:6px; 
  display:flex; 
  justify-content:space-between; 
  gap:10px; 
  background:transparent; 
  padding-top:6px; 
}
/* swipe hint */
.swipe-hint { 
  font-size:12px; 
  color:var(--muted); 
  text-align:center; 
  margin-top:4px; 
}

/* pantry list rows and panel actions */
.pantry-list { display:flex; flex-direction:column; gap:8px; }
.pantry-row { padding:8px; border-radius:6px; background:#0b0b0b; }
.panel-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:6px; }

.customer-row { display:flex; align-items:center; gap:10px; padding:8px; border-radius:6px; background:#0b0b0b; }
.cust-avatar {
  width:36px; height:36px; border-radius:50%; background:#1a1a1a; color:var(--fg);
  display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px;
  border:1px solid #111;
}
/* slightly tighter buttons for customer area */
.customer-row .big-btn { padding:8px 10px; font-size:14px; min-width:72px; }

.customer-actions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }

.store-cashier {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 1200;
  background: var(--bg);
  border-top: 1px solid #111;
  padding: 10px;
  border-radius: 8px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

/* when global setting disables qty selection, hide qty controls in-store (safe fallback) */
body[data-store-qty="off"] .qty-controls { display: none !important; }

@media (max-width: 480px){
  .customer-actions .big-btn { flex:1 1 100%; min-width:0; }
  .pantry-row, .store-card { padding:10px; }
}

/* Improve responsiveness and readability for section-panel grids (cook screen, etc.) */
.section-panel .grid,
.section-panel .store-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}
.section-panel .big-btn {
  white-space: normal;
  word-break: break-word;
  line-height: 1.28;
  align-items: flex-start; /* keep text top-aligned so badges and titles don't overlap */
}
.section-panel .big-btn strong { display:block; font-size:1.05em; }
.section-panel .big-btn .muted { display:block; margin-top:6px; opacity:0.85; }

#toast-container{
  position: fixed;
  top: 12px;
  left: 8px;
  right: 8px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none; /* allow clicks through except on individual toasts */
}

/* toast visual */
.toast{
  background: rgba(10,12,18,0.94);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  max-width: 980px;
  width: calc(100% - 48px);
  opacity: 1;
  transition: opacity .28s ease, transform .28s ease;
  pointer-events: auto; /* enable clicking to dismiss */
  font-weight: 600;
  text-align: center;
}
/* make toasts compact on very small screens */
@media (max-width:420px){
  .toast { width: calc(100% - 32px); padding: 10px 12px; font-size: 15px; }
}

body::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.02), rgba(0,0,0,0) 40%);
  mix-blend-mode: overlay;
  filter: blur(6px);
  animation: overlay-breathe 8s ease-in-out infinite;
}

@keyframes overlay-breathe {
  0%   { opacity: 0.75; transform: scale(1); }
  50%  { opacity: 0.90; transform: scale(1.02); }
  100% { opacity: 0.75; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  html, body, #app, body::before { animation: none !important; transition: none !important; }
}