/* NEMMS Canteen Food Booking Portal Stylesheet */

/* --- 1. CSS VARIABLES & THEMING --- */
:root {
  /* Colors */
  --primary-color: #2563eb;       /* Blue */
  --primary-dark: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.15);
  
  --secondary-color: #6366f1;     /* Indigo */
  --secondary-dark: #4f46e5;
  
  --accent-color: #dc2626;        /* NEMMS Red */
  --accent-glow: rgba(220, 38, 38, 0.15);
  
  --veg-color: #10b981;           /* Veg Green */
  --veg-glow: rgba(16, 185, 129, 0.12);
  
  --biryani-color: #f97316;       /* Biryani Orange */
  --biryani-glow: rgba(249, 115, 22, 0.12);
  
  --kanji-color: #06b6d4;         /* Kanji Cyan/Cream */
  --kanji-glow: rgba(6, 182, 212, 0.12);
  
  --background-grad: linear-gradient(135deg, #f0f7ff 0%, #e0e7ff 100%);
  --card-background: rgba(255, 255, 255, 0.85);
  --border-color: #e2e8f0;
  
  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #ffffff;
  
  /* Shadow & Radius */
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --btn-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* --- 2. BASE STYLING --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Quicksand', sans-serif;
  color: var(--text-primary);
  background: var(--background-grad);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .brand-text h1, .btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

#app-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* --- 3. HEADER & FOOTER --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  background: var(--primary-color);
  color: var(--text-light);
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-size: 1.25rem;
  color: #1e3a8a; /* School Navy */
}

.brand-text .subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.date-badge {
  background: rgba(255, 255, 255, 0.9);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.app-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: auto;
}

/* --- 4. VIEW LAYOUTS --- */
.view-pane {
  display: none;
  flex: 1;
}

.view-pane.active {
  display: block;
}

/* --- 5. CARDS & GENERAL UI --- */
.card {
  background: var(--card-background);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-header h2 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.step-indicator {
  display: inline-block;
  background: var(--primary-glow);
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

/* --- 6. FORMS & INPUTS --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-label i {
  color: var(--primary-color);
  margin-right: 0.25rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: #ffffff;
}

/* --- 7. BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--btn-shadow);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-color);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-secondary-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  box-shadow: none;
}

.btn-secondary-outline:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--veg-color);
  color: var(--text-light);
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-primary-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: none;
}

.btn-primary-outline:hover {
  background: var(--primary-glow);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* --- 8. STEP 2: FOOD MENU SELECTION --- */
.step-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.menu-intro h2 {
  font-size: 1.75rem;
  color: #1e3a8a;
}

.menu-intro p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.canteen-notice {
  background: #fff;
  border: 2px solid var(--border-color);
  padding: 2.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
  box-shadow: var(--card-shadow);
}

.canteen-notice i {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.canteen-notice h3 {
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.canteen-notice p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 6rem; /* space for checkout floating bar */
}

/* Card of food item */
.menu-card {
  background: var(--card-background);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
}

/* Color Accent Styles based on item type */
.menu-card.veg_meals {
  border-top: 6px solid var(--veg-color);
}
.menu-card.chicken_biryani {
  border-top: 6px solid var(--biryani-color);
}
.menu-card.kanji {
  border-top: 6px solid var(--kanji-color);
}

.menu-card-img-placeholder {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
  overflow: hidden;
}

.menu-card.veg_meals .menu-card-img-placeholder {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
.menu-card.chicken_biryani .menu-card-img-placeholder {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}
.menu-card.kanji .menu-card-img-placeholder {
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
}

.item-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.veg_meals .item-badge { color: var(--veg-color); }
.chicken_biryani .item-badge { color: var(--biryani-color); }
.kanji .item-badge { color: var(--kanji-color); }

.menu-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.menu-card-content h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.menu-card-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.menu-card-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
}

.menu-card-price {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Add Counter Buttons */
.quantity-selector {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-color);
  border-radius: 99px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.quantity-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.quantity-btn:hover {
  background: #f1f5f9;
}

.quantity-value, .quantity-input {
  width: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
}

/* Hide standard HTML5 number input spinners */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-input {
  -moz-appearance: textfield;
}

.menu-card-btn-add {
  border-radius: 99px;
  padding: 0.45rem 1.2rem;
  font-size: 0.85rem;
}

/* Floating Checkout Bar */
.float-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -10px 25px rgba(0,0,0,0.05);
  z-index: 100;
  padding: 1rem;
}

.float-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.selection-summary {
  display: flex;
  flex-direction: column;
}

.summary-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-price {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #1e3a8a;
}

/* --- 9. STEP 3: CHECKOUT & PAYMENT --- */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

.checkout-summary-card, .payment-method-card {
  max-width: 100%;
}

.student-meta-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.meta-item {
  font-size: 0.9rem;
}

.meta-label {
  color: var(--text-secondary);
  font-weight: 500;
  width: 60px;
  display: inline-block;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 1.25rem 0;
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 500;
}

.order-item-detail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.order-item-emoji {
  font-size: 1.2rem;
}

.order-item-multiply {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.total-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-color);
}

/* Payment selection labels */
.payment-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.payment-option-label {
  display: block;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.5);
}

.payment-option-label:hover {
  background: rgba(255,255,255,0.9);
  border-color: var(--text-muted);
}

.payment-option-label.active {
  border-color: var(--primary-color);
  background: var(--primary-glow);
}

.payment-option-label input[type="radio"] {
  display: none;
}

.option-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-icon {
  font-size: 1.75rem;
  color: var(--text-secondary);
}

.payment-option-label.active .option-icon {
  color: var(--primary-color);
}

.option-text {
  display: flex;
  flex-direction: column;
}

.option-text strong {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.option-text span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* UPI Payment QR and Deep Link Area */
.upi-pay-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.qr-code-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  border: 2px solid var(--border-color);
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-wrapper img {
  max-width: 100%;
  max-height: 100%;
}

.qr-overlay-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
}

.upi-instructions {
  width: 100%;
}

.instruction-main {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.upi-vpa-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.mobile-only-redirect {
  display: none;
  width: 100%;
  margin-top: 0.5rem;
}

.or-separator {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0.5rem 0;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .mobile-only-redirect {
    display: block;
  }
}

/* --- 10. MASCOT INTERACTIVE ANIMATION OVERLAY --- */
.animation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, #eef2ff 0%, #c7d2fe 100%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.animation-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  max-width: 450px;
  height: 480px;
}

.flying-food-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 120px;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
}

/* Falling/Flying food item animations */
.flying-food {
  position: absolute;
  font-size: 2.2rem;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.15));
  pointer-events: none;
}

.mascot-frame {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 1rem;
}

.mascot-character {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.buddy-body {
  width: 100%;
  height: 100%;
  transform-origin: bottom center;
  animation: buddy-bounce 2s infinite ease-in-out;
}

.custom-mascot-img-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: buddy-bounce 2s infinite ease-in-out;
}

.custom-mascot-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Mouth overlay overlayed on PNG mascot if upload is used */
.eating-mouth-overlay {
  position: absolute;
  top: 52%;
  left: 45%;
  width: 20px;
  height: 10px;
  border-radius: 99px;
  background: #1e293b;
  transform: translate(-50%, -50%);
  display: none;
}

/* Speech Bubble */
.animation-speech {
  position: absolute;
  top: 20px;
  right: 10px;
  z-index: 20;
  transform: scale(0);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.animation-speech.visible {
  transform: scale(1);
  opacity: 1;
}

.speech-bubble {
  background: #ffffff;
  border: 3px solid #1e3a8a;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: var(--card-shadow);
}

.speech-bubble p {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: #1e3a8a;
  text-transform: uppercase;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 20px;
  border-width: 15px 15px 0 0;
  border-style: solid;
  border-color: #ffffff transparent;
  display: block;
  width: 0;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -19px;
  left: 18px;
  border-width: 16px 16px 0 0;
  border-style: solid;
  border-color: #1e3a8a transparent;
  display: block;
  width: 0;
  z-index: -1;
}

/* Dish Overlay */
.animation-dish-overlay {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.animation-caption {
  text-align: center;
}

.animation-caption h3 {
  font-size: 1.4rem;
  color: #1e3a8a;
  margin-bottom: 0.25rem;
}

.animation-caption p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Mascot SVG Animation Loops */
@keyframes buddy-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.02);
  }
}

.mascot-eye-blink {
  animation: eye-blink-loop 4s infinite;
  transform-origin: center;
}

@keyframes eye-blink-loop {
  0%, 45%, 55%, 100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0.1);
  }
}

/* Interactive custom states triggered by app.js */
.chewing {
  animation: chewing-action 0.4s infinite alternate;
}

@keyframes chewing-action {
  0% {
    transform: scaleY(1);
  }
  100% {
    transform: scaleY(3.5);
  }
}

.body-excited {
  animation: excited-bounce 0.2s infinite;
}

@keyframes excited-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(2deg); }
  75% { transform: translateY(-12px) rotate(-2deg); }
}

.chewing-jaw {
  animation: jaw-bite 0.3s infinite ease-in-out;
}

@keyframes jaw-bite {
  0%, 100% { d: path("M 90 115 Q 100 120, 110 115"); }
  50% { d: path("M 90 115 Q 100 135, 110 115"); }
}

/* Custom food elements flying into mouth paths */
@keyframes fly-to-mouth {
  0% {
    transform: translate(var(--start-x), var(--start-y)) scale(1) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate(100px, 115px) scale(0.1) rotate(360deg);
    opacity: 0;
  }
}

/* Sparkles, hearts rising up */
.sparkle-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.5rem;
  animation: float-rise 1.5s forwards ease-out;
}

@keyframes float-rise {
  0% {
    transform: translate(var(--x), var(--y)) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--x) + var(--vx)), calc(var(--y) - 100px)) scale(1.5);
    opacity: 0;
  }
}

/* --- 11. STEP 4: RECEIPT DISPLAY --- */
.receipt-card {
  max-width: 480px;
  margin: 1.5rem auto;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.receipt-success-banner {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--text-light);
  text-align: center;
  padding: 2rem 1.5rem;
}

.success-icon {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
}

.receipt-success-banner h2 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.receipt-success-banner p {
  font-size: 0.85rem;
  opacity: 0.9;
}

.receipt-body {
  padding: 1.5rem;
  background: #f8fafc;
}

/* The Ticket mockup */
.receipt-ticket {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  position: relative;
}

.ticket-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1.5px dashed var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.ticket-school {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.ticket-title {
  font-size: 1rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: 0.5px;
}

.ticket-token-display {
  text-align: center;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
}

.token-num-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.token-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: #dc2626;
  letter-spacing: 1px;
}

.ticket-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.t-label {
  color: var(--text-secondary);
}

.t-value {
  color: var(--text-primary);
  font-weight: 600;
}

.text-right {
  text-align: right;
}

.ticket-divider {
  border: 0;
  border-top: 1px dashed var(--border-color);
  margin: 0.5rem 0;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.status-badge.paid {
  background: var(--veg-glow);
  color: var(--veg-color);
}

.status-badge.pending {
  background: #fef3c7;
  color: #d97706;
}

.ticket-scan-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.barcode-mock {
  display: flex;
  height: 35px;
  width: 80%;
  margin-bottom: 0.5rem;
}

.barcode-mock span {
  flex: 1;
  background: #1e293b;
}

/* Randomize barcode lines roughly */
.barcode-mock span:nth-child(3n) { background: transparent; }
.barcode-mock span:nth-child(5n) { flex: 2; }
.barcode-mock span:nth-child(7n) { flex: 0.5; }

.timestamp-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.receipt-actions {
  padding: 1.5rem;
  background: #ffffff;
}

/* --- 12. ADMIN AUTH MODAL --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  width: 100%;
  overflow: hidden;
  animation: modal-enter 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-enter {
  0% { transform: scale(0.9) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.error-text {
  display: block;
  font-size: 0.8rem;
  color: var(--accent-color);
  margin-top: 0.35rem;
  font-weight: 600;
}

/* --- 13. ADMIN VIEW PANEL --- */
.admin-page-body #app-container {
  max-width: 100% !important;
  width: 100% !important;
  padding: 1.5rem 2rem !important;
  box-sizing: border-box;
}

.admin-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
}

.admin-title-area h2 {
  font-size: 1.5rem;
  color: #1e3a8a;
}

.admin-title-area p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Quick Statistics Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.bg-blue-tint { background: #eff6ff; color: var(--primary-color); }
.bg-green-tint { background: #ecfdf5; color: var(--veg-color); }
.bg-yellow-tint { background: #fffbeb; color: #d97706; }
.bg-orange-tint { background: #fff7ed; color: var(--biryani-color); }

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-details h3 {
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 800;
}

/* Layout Split */
.admin-main-grid {
  display: grid;
  grid-template-columns: 1fr 2.5fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 992px) {
  .admin-main-grid {
    grid-template-columns: 1fr;
  }
}

.admin-config-col, .admin-data-col {
  width: 100%;
}

/* Toggle Switches */
.menu-activation-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.menu-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.toggle-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.food-emoji {
  font-size: 1.5rem;
}

.toggle-info strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.toggle-price {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Custom CSS Toggle Slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--veg-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* Settings Form elements */
.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

.price-input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.form-label-small {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.25rem;
}

.form-input-small {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

/* Bookings list Table Card */
.table-card {
  max-width: 100%;
  padding: 1.5rem;
}

.table-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.header-action-buttons {
  display: flex;
  gap: 0.5rem;
}

.table-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .table-filters {
    flex-direction: column;
  }
}

.search-box {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.filter-select {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.table-scroll-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.actions-column {
  text-align: right;
}

.admin-actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.table-placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.table-placeholder p {
  margin-top: 0.5rem;
}

/* Badge in table */
.tbl-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
}

.tbl-badge.paid { background: #d1fae5; color: #065f46; }
.tbl-badge.pending { background: #fef3c7; color: #92400e; }
.tbl-badge.served { background: #e2e8f0; color: #475569; }
.tbl-badge.cancelled { background: #fee2e2; color: #991b1b; }

/* Tooltip/Helper utility styles */
.text-center { text-align: center; }
.fade-in {
  animation: key-fade-in 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes key-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 14. A4 PRINT STYLESHEET (PORTRAIT) --- */
#a4-print-sheet {
  display: none; /* Hide from standard screen display */
}

@media print {
  /* Hide all core web elements when printing */
  #app-container, .no-print, .modal-overlay, #student-view, #admin-view, header, footer {
    display: none !important;
  }
  
  body, html {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Setup A4 Page Properties */
  @page {
    size: A4 portrait;
    margin: 10mm 10mm 10mm 10mm;
  }
  
  /* Print Grid Container */
  #a4-print-sheet {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 2 Columns */
    grid-template-rows: repeat(8, 1fr) !important;    /* 8 Rows = 16 tokens */
    grid-gap: 3mm 4mm !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Token Card Item for print */
  .print-token-card {
    border: 1px dashed #475569 !important;
    border-left: 5px solid #000000 !important; /* styled dynamically or by class color */
    border-radius: 4px !important;
    padding: 1.5mm 2.5mm !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important; /* left/right layout */
    justify-content: space-between !important;
    height: 31mm !important;
    page-break-inside: avoid !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Dynamic color strips */
  .print-token-card.veg_meals { border-left-color: #10b981 !important; }
  .print-token-card.chicken_biryani { border-left-color: #f97316 !important; }
  .print-token-card.kanji { border-left-color: #06b6d4 !important; }

  /* Left Side: Core Details */
  .token-print-left {
    width: 65% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }

  .token-print-school {
    font-size: 6.5pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    color: #1e3a8a !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .token-print-student-name {
    font-size: 11pt !important;
    font-weight: 900 !important;
    color: #000000 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0.25mm 0 !important;
  }

  .token-print-student-class {
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    color: #000000 !important;
  }

  .token-print-meta, .token-print-items {
    font-size: 7pt !important;
    line-height: 1.25 !important;
    color: #334155 !important;
  }
  
  .token-print-items strong {
    font-weight: 700 !important;
  }

  .token-print-timestamp {
    font-size: 5.5pt !important;
    color: #64748b !important;
    margin-top: 0.5mm !important;
  }

  /* Right Side: Stub & Number */
  .token-print-right {
    width: 32% !important;
    border-left: 1px dashed #cbd5e1 !important;
    padding-left: 2mm !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  .token-print-number {
    font-size: 13pt !important;
    font-weight: 900 !important;
    color: #dc2626 !important;
    line-height: 1 !important;
  }

  .token-print-icon {
    font-size: 15pt !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0.5mm 0 !important;
  }

  .token-print-payment {
    font-size: 12pt !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    color: #000000 !important;
    white-space: normal !important;
    line-height: 1.1 !important;
  }
}

/* --- 14. ADMIN MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
  body, #app-container, #admin-view {
    max-width: 100% !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }
  
  /* Prevent cards from centering with auto margins and capping at 600px */
  .admin-main-grid .card {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1.25rem !important; /* Slightly reduce padding on mobile */
  }

  .admin-top-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 1rem;
    padding: 1rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .admin-top-bar button {
    width: 100%;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .stat-card {
    padding: 1rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .admin-main-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    width: 100% !important;
    max-width: 100% !important;
  }

  .admin-config-col, .admin-data-col {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important; /* Allow columns to shrink on mobile */
    box-sizing: border-box;
  }

  .table-card {
    max-width: 100% !important;
    width: 100% !important;
  }

  .table-scroll-container {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .header-action-buttons {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .header-action-buttons button {
    width: 100%;
    padding: 0.6rem;
  }
  
  .table-filters {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .table-filters select, .table-filters input {
    width: 100%;
  }

  .admin-table th, .admin-table td {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .price-input-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
  }
  .price-input-grid .form-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
  }
  .price-input-grid .form-label-small {
    margin-bottom: 0;
  }
  .price-input-grid .form-input-small {
    width: 100px;
  }
}
