@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #f97316;
  --primary-hover: #ea580c;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --green: #10b981;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 24px 24px;
  height: 100vh; /* Forces app to fit screen */
  overflow: hidden; /* Removes main page scrollbar */
}

button, a { font: inherit; }
button { cursor: pointer; border: none; outline: none; }
a { text-decoration: none; }

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---------- HEADER ---------- */
.top-header {
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(10px);
  color: #fff;
  z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mascot { font-size: 34px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.brand-copy h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.5px; display: flex; gap: 4px; }
.brand-copy h1 span:first-child { color: #fff; }
.brand-copy h1 .accent { 
  background: linear-gradient(135deg, #f97316, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-copy p { font-size: 10px; color: #94a3b8; margin-top: 2px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.brand-copy strong { color: #cbd5e1; }

.header-actions { display: flex; align-items: center; gap: 20px; }
.summary-link {
  padding: 8px 16px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
}
.summary-link:hover { background: rgba(255,255,255,0.15); }
.online-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #cbd5e1; }
.online-status i {
  width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--green); box-shadow: 0 0 12px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------- LAYOUT ---------- */
.pos-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden; /* Prevents the whole page from scrolling */
}

/* ---------- PRODUCTS SECTION ---------- */
.products-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.section-heading {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.section-heading h2 { font-size: 20px; font-weight: 800; }
.section-heading p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.live-status { padding: 6px 14px; border-radius: 8px; background: #fff7ed; color: #ea580c; font-size: 12px; font-weight: 800; border: 1px solid #ffedd5; }

/* This allows only the cards to scroll */
.menu-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px; /* space for scrollbar */
}

/* Scrollbar styling */
.menu-scroll-area::-webkit-scrollbar, .cart-list::-webkit-scrollbar { width: 6px; }
.menu-scroll-area::-webkit-scrollbar-track, .cart-list::-webkit-scrollbar-track { background: transparent; }
.menu-scroll-area::-webkit-scrollbar-thumb, .cart-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.menu-scroll-area::-webkit-scrollbar-thumb:hover, .cart-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding-bottom: 10px;
}
.menu-grid > * {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.2s ease;
  min-height: 100px;
  cursor: pointer;
}
.menu-grid > *:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px -4px rgba(249, 115, 22, 0.15);
  transform: translateY(-2px);
}
.menu-grid > * h1, .menu-grid > * h2, .menu-grid > * h3, .menu-grid > * h4,
.menu-grid > * .name, .menu-grid > * .product-name {
  font-size: 16px; font-weight: 800; color: var(--text-main);
  margin-bottom: 6px; line-height: 1.3;
}
.menu-grid > * p, .menu-grid > * .price, .menu-grid > * .product-price {
  font-size: 18px; font-weight: 900; color: var(--primary); margin: 0;
}
.menu-grid > * img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; }
.menu-grid > * button, .menu-grid > * .add-btn {
  position: absolute; right: 16px; bottom: 16px;
  width: 36px; height: 36px; border-radius: 10px;
  background: #fff7ed; color: var(--primary); font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #ffedd5; transition: all 0.2s; box-shadow: 0 2px 6px rgba(249, 115, 22, 0.1);
}
.menu-grid > * button:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.05); }

/* ---------- CART SECTION ---------- */
.cart {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: 100%; /* Fills the exact height of the row */
  overflow: hidden;
}
.cart-heading {
  padding: 20px 24px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.cart-heading h2 { font-size: 18px; font-weight: 800; }
.cart-count {
  background: var(--primary); color: #fff; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.cart-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  background: #fafafa;
}
.empty-cart { text-align: center; padding: 40px 0; display: flex; flex-direction: column; align-items: center; }
.empty-icon { font-size: 48px; margin-bottom: 16px; background: #f1f5f9; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.empty-cart h3 { font-size: 16px; font-weight: 800; color: var(--text-main); }
.empty-cart p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.cart-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.cart-item:last-child { border-bottom: none; }
.ci-img { width: 48px; height: 48px; border-radius: 10px; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.ci-info { flex: 1; }
.ci-info strong { display: block; font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.ci-price { font-size: 15px; font-weight: 800; color: var(--primary); }
.qty-ctrl { display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-ctrl button { width: 28px; height: 28px; background: transparent; color: var(--text-main); font-size: 16px; font-weight: 600; }
.qty-ctrl button:hover { background: #f1f5f9; color: var(--primary); }
.qty-ctrl span { width: 28px; text-align: center; font-size: 13px; font-weight: 800; }
.ci-remove { width: 28px; height: 28px; border-radius: 8px; background: #fef2f2; color: var(--danger); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; margin-left: 4px; transition: 0.2s; }
.ci-remove:hover { background: var(--danger); color: #fff; }

.cart-footer {
  padding: 20px 24px; background: #fff; border-top: 1px solid var(--border); flex-shrink: 0;
}
.total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.total-row span { font-size: 15px; font-weight: 700; color: var(--text-muted); }
.total-row div { font-size: 28px; font-weight: 900; color: var(--text-main); display: flex; align-items: center; gap: 2px; }
.total-row div span:first-child { color: var(--primary); font-size: 20px; }

.payment-label { font-size: 11px; font-weight: 800; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.payment-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.pay-btn { padding: 10px; border-radius: 10px; background: #fff; border: 2px solid var(--border); font-size: 13px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s; }
.pay-btn:hover { border-color: var(--primary); background: #fff7ed; }
.pay-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25); }

.print-btn {
  width: 100%; padding: 0 24px; height: 54px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #ea580c);
  color: #fff; font-size: 15px; font-weight: 800;
  display: flex; justify-content: space-between; align-items: center;
  transition: all 0.3s; box-shadow: 0 8px 20px -4px rgba(249, 115, 22, 0.4);
}
.print-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 25px -4px rgba(249, 115, 22, 0.5); }
.print-btn:disabled { background: #e2e8f0; color: #94a3b8; box-shadow: none; cursor: not-allowed; background-image: none; }
.print-btn span:last-child { font-size: 20px; line-height: 1; }
.powered-text { text-align: center; font-size: 10px; color: #94a3b8; margin-top: 12px; font-weight: 600; }
.powered-text strong { color: var(--primary); }

/* ---------- FOOTER ---------- */
.app-footer {
  height: 48px; flex-shrink: 0; padding: 0 28px;
  background: #fff; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.app-footer strong { color: var(--text-main); }

/* ---------- RESPONSIVE (MOBILE) ---------- */
@media (max-width: 1024px) {
  body { height: auto; overflow: auto; } /* Restore normal scrolling on mobile */
  .pos-layout { grid-template-columns: 1fr; height: auto; overflow: visible; padding: 16px; }
  .products-section { height: auto; padding: 16px; }
  .menu-scroll-area { overflow: visible; } /* Let the whole page scroll instead */
  .cart { height: auto; margin-bottom: 20px; }
  .cart-list { max-height: 300px; }
}

@media (max-width: 640px) {
  .top-header { padding: 0 16px; height: 64px; }
  .brand-copy h1 { font-size: 20px; }
  .summary-link, .online-status { display: none; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .app-footer { flex-direction: column; gap: 4px; text-align: center; padding: 12px; height: auto; }
  .cart-heading, .cart-footer { padding: 16px; }
  .cart-list { padding: 16px; }
}