/**
 * PANOVA Café — Cashier Admin Dashboard & POS Kitchen Screen Styles
 * Optimized for cashier desktop, POS touch terminals, and 80mm thermal receipt printing.
 */

:root {
  --admin-bg: #F4EFE6;
  --admin-surface: #FFFFFF;
  --admin-card: #FFFFFF;
  --admin-border: rgba(32, 12, 4, 0.08);
  --admin-espresso: #200C04;
  --admin-gold: #B8975A;
  --admin-gold-dark: #785926;
  --admin-sand: #EFE4D3;
  --admin-text: #200C04;
  --admin-muted: #6B5D4F;
  --status-new: #B8975A;
  --status-accepted: #2563EB;
  --status-preparing: #7C3AED;
  --status-ready: #16A34A;
  --status-completed: #475569;
  --status-cancelled: #DC2626;
}

body.admin-body {
  margin: 0;
  padding: 0;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ================= HEADER ================= */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #FFFFFF;
  border-bottom: 1px solid var(--admin-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(32, 12, 4, 0.04);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-logo {
  height: 36px;
  width: auto;
}

.admin-pos-badge {
  background: #200C04;
  color: #FAF6EF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #16A34A;
  background: rgba(22, 163, 74, 0.1);
  padding: 4px 10px;
  border-radius: 9999px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #16A34A;
  border-radius: 50%;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.admin-btn-gold {
  background: #B8975A;
  color: #200C04;
}

.admin-btn-gold:hover {
  background: #785926;
  color: #FAF6EF;
}

.admin-btn-outline {
  background: #FFFFFF;
  color: #200C04;
  border-color: var(--admin-border);
}

.admin-btn-outline:hover {
  border-color: #B8975A;
  background: #FAF6EF;
}

.admin-btn-dark {
  background: #200C04;
  color: #FAF6EF;
}

.admin-btn-dark:hover {
  background: #3B2416;
}

/* Sound Toggle Button */
.sound-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #FAF6EF;
  border: 1px solid var(--admin-border);
  color: #200C04;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sound-toggle-btn.muted {
  color: #DC2626;
  background: #FEE2E2;
  border-color: #F87171;
}

/* ================= CONTAINER & TABS ================= */
.admin-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.admin-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

@media (min-width: 992px) {
  .admin-controls-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.status-tabs-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.status-tabs-list::-webkit-scrollbar {
  display: none;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  color: #554335;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.status-tab:hover {
  border-color: #B8975A;
  color: #200C04;
}

.status-tab.active {
  background: #200C04;
  color: #FAF6EF;
  border-color: #200C04;
}

.tab-badge {
  background: #EFE4D3;
  color: #200C04;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
}

.status-tab.active .tab-badge {
  background: #B8975A;
  color: #200C04;
}

.tab-badge.badge-alert {
  background: #DC2626;
  color: #FFFFFF;
  animation: pulseBadge 1.2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.admin-search-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-search-input {
  height: 40px;
  padding: 0 14px 0 36px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  color: #200C04;
  outline: none;
  width: 240px;
  transition: border-color 0.15s;
}

.admin-search-input:focus {
  border-color: #B8975A;
}

/* ================= ORDERS GRID ================= */
.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .orders-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.order-card {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(32, 12, 4, 0.03);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(32, 12, 4, 0.06);
}

.order-card.status-submitted {
  border-left: 5px solid var(--status-new);
}

.order-card.status-accepted {
  border-left: 5px solid var(--status-accepted);
}

.order-card.status-preparing {
  border-left: 5px solid var(--status-preparing);
}

.order-card.status-ready {
  border-left: 5px solid var(--status-ready);
}

.order-card.status-completed {
  border-left: 5px solid var(--status-completed);
  opacity: 0.85;
}

.order-card.status-cancelled {
  border-left: 5px solid var(--status-cancelled);
  opacity: 0.65;
}

.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
  padding-bottom: 10px;
}

.order-num-tag {
  font-size: 13px;
  font-weight: 700;
  color: #785926;
  letter-spacing: 0.02em;
}

.order-token-chip {
  background: linear-gradient(135deg, #B8975A 0%, #785926 100%);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(120, 89, 38, 0.25);
}

.order-type-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-type-chip.chip-dinein {
  background: #F4EFEA;
  color: #554335;
  border: 1px solid #E6DCCD;
}

.order-type-chip.chip-takeaway {
  background: #FFF0EB;
  color: #C2410C;
  border: 1px solid #FDBA74;
}

.order-table-chip {
  background: #200C04;
  color: #FAF6EF;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 4px;
}

.order-time-tag {
  font-size: 11px;
  color: var(--admin-muted);
  text-align: right;
}

.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 9999px;
  margin-top: 4px;
}

.status-badge.badge-submitted {
  background: rgba(184, 151, 90, 0.2);
  color: #785926;
  border: 1px solid #B8975A;
}

.status-badge.badge-accepted {
  background: #DBEAFE;
  color: #1D4ED8;
}

.status-badge.badge-preparing {
  background: #EDE9FE;
  color: #6D28D9;
}

.status-badge.badge-ready {
  background: #DCFCE7;
  color: #15803D;
}

.status-badge.badge-completed {
  background: #F1F5F9;
  color: #475569;
}

.status-badge.badge-cancelled {
  background: #FEE2E2;
  color: #B91C1C;
}

/* Customer Info */
.order-cust-info {
  margin-bottom: 10px;
  font-size: 12px;
  color: #554335;
}

.order-cust-name {
  font-size: 13px;
  font-weight: 700;
  color: #200C04;
}

.order-notes-box {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #92400E;
  margin: 8px 0;
}

/* Items List inside card */
.order-items-table {
  width: 100%;
  margin: 10px 0;
  border-collapse: collapse;
}

.order-item-row {
  border-bottom: 1px solid rgba(32, 12, 4, 0.05);
}

.order-item-row td {
  padding: 6px 0;
  font-size: 12px;
}

.order-item-qty {
  font-weight: 800;
  color: #785926;
  width: 28px;
}

.order-item-name {
  font-weight: 600;
  color: #200C04;
}

.order-item-customs {
  font-size: 10px;
  color: #785926;
  display: block;
}

.order-item-price {
  text-align: right;
  font-weight: 700;
  color: #200C04;
  white-space: nowrap;
}

/* Order Footer & Action buttons */
.order-card-footer {
  margin-top: 14px;
  border-top: 1px solid var(--admin-border);
  padding-top: 12px;
}

.order-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.order-grand-total {
  font-size: 17px;
  font-weight: 800;
  color: #200C04;
}

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

.btn-primary-action {
  flex: 1;
  height: 38px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-accept {
  background: #B8975A;
  color: #200C04;
}

.btn-accept:hover {
  background: #785926;
  color: #FAF6EF;
}

.btn-prepare {
  background: #7C3AED;
  color: #FFFFFF;
}

.btn-ready {
  background: #16A34A;
  color: #FFFFFF;
}

.btn-complete {
  background: #200C04;
  color: #FAF6EF;
}

.btn-icon-secondary {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #FAF6EF;
  border: 1px solid var(--admin-border);
  color: #200C04;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-secondary:hover {
  border-color: #B8975A;
}

/* ================= MODAL / CSV EXPORT STYLES ================= */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 4, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.admin-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-dialog {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 20px 50px rgba(32, 12, 4, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

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

.admin-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #200C04;
  margin: 0;
}

.admin-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.admin-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #FAF6EF;
}

/* ================= PRINTABLE THERMAL RECEIPT / KOT STYLES ================= */
#printable-kot-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  #printable-kot-container, #printable-kot-container * {
    visibility: visible;
  }

  #printable-kot-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    margin: 0;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #000;
    line-height: 1.3;
  }

  .kot-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .kot-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
  }

  .kot-table-huge {
    font-size: 24px;
    font-weight: bold;
    margin: 6px 0;
  }

  .kot-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
  }

  .kot-items-table th, .kot-items-table td {
    padding: 4px 0;
    text-align: left;
  }

  .kot-items-table th:last-child, .kot-items-table td:last-child {
    text-align: right;
  }

  .kot-footer {
    border-top: 1px dashed #000;
    padding-top: 8px;
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
  }
}
