/* components.css - Menu Cards, Category Tabs, Modals, Cart Bar, Voucher & Admin Controls */

/* Nav Header Buttons & Tabs */
.btn-nav-voucher {
  background-color: var(--isaac-yellow);
  color: var(--text-primary);
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.btn-nav-voucher:active {
  transform: scale(0.95);
}

.category-tabs-nav {
  display: flex;
  overflow-x: auto;
  background-color: var(--bg-card);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  gap: 8px;
  flex-shrink: 0;
  scrollbar-width: none;
}

.category-tabs-nav::-webkit-scrollbar {
  display: none;
}

.category-tab-btn {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-tab-btn.active {
  background-color: var(--isaac-red);
  color: #FFFFFF;
  border-color: var(--isaac-red);
  box-shadow: 0 4px 10px rgba(227, 30, 36, 0.25);
}

.category-tab-btn.special-voucher {
  border-color: var(--isaac-orange);
  color: var(--isaac-orange-dark);
}

.category-tab-btn.special-voucher.active {
  background-color: var(--isaac-orange);
  color: #FFFFFF;
}

/* Main Menu Grid */
.menu-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.menu-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

.menu-card-img-wrapper {
  width: 100%;
  height: 130px;
  background-color: #FAFAFA;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.menu-card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.menu-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.menu-card-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--isaac-red);
  background-color: var(--isaac-red-light);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
  align-self: flex-start;
}

.menu-card-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--isaac-red);
}

/* Option Modal */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-backdrop[hidden] {
  display: none !important;
  opacity: 0;
}

.option-modal-content {
  width: 100%;
  max-height: 85%;
  background-color: var(--bg-card);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.option-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-modal-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.option-group-item {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-light);
}

.option-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.option-group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.option-group-max {
  font-size: 12px;
  color: var(--isaac-orange-dark);
  background-color: var(--isaac-orange-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.option-single-choices {
  display: flex;
  gap: 8px;
}

.btn-choice-single {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-choice-single.selected {
  background-color: var(--isaac-red-light);
  border-color: var(--isaac-red);
  color: var(--isaac-red);
}

.option-quantity-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-md);
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background-color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--text-primary);
}

.stepper-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stepper-value {
  font-size: 16px;
  font-weight: 800;
  min-width: 30px;
  text-align: center;
}

.option-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-modal-total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 800;
}

.btn-add-to-cart {
  width: 100%;
  padding: 14px;
  background-color: var(--isaac-red);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.3);
}

/* Cart Bar (Fixed Bottom) */
.cart-bar {
  background-color: var(--bg-card);
  border-top: 2px solid var(--isaac-red);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 90;
  flex-shrink: 0;
}

.cart-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #FFFFFF;
}

.cart-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-count-badge {
  background-color: var(--isaac-red);
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.cart-total-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--isaac-red);
}

.btn-checkout {
  padding: 12px 24px;
  background-color: var(--isaac-red);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.3);
  transition: opacity 0.2s, transform 0.15s;
}

.btn-checkout:disabled {
  background-color: var(--border-medium);
  box-shadow: none;
  cursor: not-allowed;
}

.cart-items-preview {
  max-height: 180px;
  overflow-y: auto;
  padding: 8px 16px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.cart-item-main {
  flex: 1;
}

.cart-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.cart-item-options {
  font-size: 12px;
  color: var(--text-secondary);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-medium);
  background-color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Checkout Screen */
.checkout-screen {
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.checkout-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.checkout-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-type-toggle {
  display: flex;
  gap: 10px;
  background-color: var(--bg-subtle);
  padding: 6px;
  border-radius: var(--radius-pill);
}

.btn-toggle-type {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  background-color: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-toggle-type.active {
  background-color: var(--isaac-red);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(227, 30, 36, 0.25);
}

.bill-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.bill-row.discount {
  color: var(--isaac-red);
  font-weight: 700;
}

.bill-row.total {
  border-top: 2px dashed var(--border-medium);
  margin-top: 10px;
  padding-top: 14px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
}

.free-payment-badge {
  background-color: var(--isaac-red-light);
  color: var(--isaac-red);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
}

.btn-pay-now {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--isaac-red) 0%, var(--isaac-red-dark) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(227, 30, 36, 0.35);
  margin-top: auto;
}

.btn-pay-now:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Complete Screen */
.complete-screen {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  background-color: var(--bg-card);
}

.order-number-box {
  background: linear-gradient(135deg, var(--isaac-red-light) 0%, #FFF 100%);
  border: 3px solid var(--isaac-red);
  border-radius: var(--radius-xl);
  padding: 30px 40px;
  margin: 20px 0;
  box-shadow: var(--shadow-kiosk);
}

.order-number-label {
  font-size: 16px;
  font-weight: 800;
  color: var(--isaac-red);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.order-number-val {
  font-family: var(--font-family-mono);
  font-size: 80px;
  font-weight: 900;
  color: var(--isaac-red);
  line-height: 1;
}

.reset-countdown {
  margin-top: 30px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Voucher Screen */
.voucher-screen {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.voucher-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.voucher-card {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--isaac-yellow-light) 100%);
  border: 2px solid var(--isaac-yellow);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.voucher-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.voucher-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--isaac-orange-dark);
}

.btn-issue-voucher {
  background-color: var(--isaac-orange);
  color: #FFFFFF;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(245, 166, 35, 0.3);
}

/* Voucher Issued Result Container */
.voucher-result-box {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border: 2px dashed var(--isaac-orange);
}

.voucher-code-display {
  font-family: var(--font-family-mono);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--isaac-orange-dark);
  background-color: var(--isaac-orange-light);
  padding: 8px 16px;
  border-radius: var(--radius-md);
}

.barcode-canvas, .qr-canvas {
  background-color: #FFF;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

/* Admin Screen */
.admin-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #F3F4F6;
}

.admin-header {
  background-color: var(--bg-dark);
  color: #FFF;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-tabs {
  display: flex;
  background-color: #374151;
  overflow-x: auto;
  padding: 4px;
  gap: 4px;
}

.admin-tab-btn {
  background: none;
  border: none;
  color: #D1D5DB;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.admin-tab-btn.active {
  background-color: var(--isaac-red);
  color: #FFF;
}

.admin-content-area {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
}

.admin-card {
  background-color: #FFF;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.admin-table th, .admin-table td {
  padding: 8px;
  border: 1px solid var(--border-light);
  text-align: left;
}

.admin-table th {
  background-color: var(--bg-subtle);
  font-weight: 700;
}

.admin-form-group {
  margin-bottom: 12px;
}

.admin-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.admin-form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.admin-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn-primary { background-color: var(--isaac-red); color: #FFF; }
.admin-btn-secondary { background-color: var(--text-secondary); color: #FFF; }
.admin-btn-danger { background-color: var(--color-danger); color: #FFF; }

/* Sold Out Overlay Styles */
.sold-out-card {
  opacity: 0.6;
  position: relative;
  cursor: not-allowed !important;
}

.sold-out-card:active {
  transform: none !important;
}

.sold-out-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  color: #FFFFFF;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Global API loading & toast */
#global-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
  color: var(--isaac-red);
}

#global-loading-overlay[hidden] {
  display: none !important;
}

.global-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-light);
  border-top-color: var(--isaac-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.global-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  max-width: 90%;
  text-align: center;
}

.global-toast[hidden] {
  display: none !important;
}

.global-toast-error {
  background: #FFE5E5;
  color: #B00020;
  border: 1px solid #FFB3B3;
}

.global-toast-success {
  background: #E8F5E9;
  color: #1B5E20;
  border: 1px solid #A5D6A7;
}

.global-toast-warn {
  background: #FFF8E1;
  color: #E65100;
  border: 1px solid #FFE082;
}

/* Home button & order type banner */
.btn-go-home:active {
  transform: scale(0.95);
}

.menu-order-type-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.menu-order-type-chip {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.menu-order-type-chip.eat-in {
  background: #FFE5E5;
  color: var(--isaac-red);
}

.menu-order-type-chip.take-out {
  background: #FFF3E0;
  color: #E65100;
}

.menu-order-type-note {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Kitchen Display System (KDS) */
body.kds-mode #kiosk-wrapper {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.kds-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #1a1a1a;
}

.kds-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  gap: 10px;
}

.kds-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #2d2d2d;
  border-radius: 10px;
  color: #fff;
  flex-shrink: 0;
}

.kds-toolbar-title {
  font-size: 18px;
  font-weight: 900;
  flex: 1;
}

.kds-toolbar-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #ddd;
}

.kds-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  min-height: 0;
}

.kds-slot {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 3px solid #ddd;
}

.kds-slot-empty {
  background: #f3f3f3;
  border-style: dashed;
  color: #999;
}

.kds-slot-active.eat-in {
  border-color: var(--isaac-red);
}

.kds-slot-active.take-out {
  border-color: #F5A623;
}

.kds-slot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.kds-slot-no {
  color: #888;
}

.kds-slot-type {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
}

.kds-slot-active.eat-in .kds-slot-type {
  background: #FFE5E5;
  color: var(--isaac-red);
}

.kds-slot-active.take-out .kds-slot-type {
  background: #FFF3E0;
  color: #E65100;
}

.kds-slot-time {
  margin-left: auto;
  color: #666;
  font-weight: 600;
}

.kds-order-number {
  font-size: 42px;
  font-weight: 900;
  font-family: var(--font-family-mono);
  color: var(--isaac-red);
  line-height: 1;
  margin-bottom: 8px;
  text-align: center;
}

.kds-slot-empty-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.kds-items {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  margin-bottom: 8px;
}

.kds-item {
  border-top: 1px solid #eee;
  padding: 6px 0;
}

.kds-item:first-child {
  border-top: none;
}

.kds-item-name {
  font-size: 14px;
  font-weight: 800;
  color: #222;
  margin-bottom: 4px;
}

.kds-item-qty {
  color: var(--isaac-red);
}

.kds-item-options {
  list-style: none;
  margin: 0;
  padding: 0 0 0 8px;
}

.kds-item-options li {
  font-size: 12px;
  line-height: 1.45;
  color: #444;
  padding: 1px 0;
  border-left: 2px solid #e0e0e0;
  padding-left: 8px;
  margin-bottom: 2px;
}

.kds-item-options li.kds-voucher {
  color: var(--isaac-orange-dark);
  font-weight: 700;
}

.btn-kds-complete {
  width: 100%;
  padding: 10px !important;
  font-size: 13px !important;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .kds-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }
}
