/* BrewPOS — Premium Coffee Shop Design System */
:root,
[data-theme="light"],
html {
  --espresso: #2C1810;
  --latte: #C4A574;
  --cream: #F5E6D3;
  --soft-black: #1A0F0A;
  --caramel: #D4A574;
  --bg-primary: #F5F0E8;
  --bg-secondary: #FFFFFF;
  --text-primary: #2C1810;
  --text-secondary: rgba(44, 24, 16, 0.65);
  --border: rgba(44, 24, 16, 0.12);
  --glass: rgba(255, 255, 255, 0.9);
  --shadow: 0 8px 32px rgba(26, 15, 10, 0.08);
  --shadow-lg: 0 20px 60px rgba(26, 15, 10, 0.12);
  --radius: 16px;
  --radius-lg: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.font-display { font-family: 'Playfair Display', serif; }

/* Tailwind custom colors */
.bg-espresso { background-color: var(--espresso); }
.bg-latte { background-color: var(--latte); }
.bg-cream { background-color: var(--cream); }
.bg-soft-black { background-color: var(--soft-black); }
.bg-caramel { background-color: var(--caramel); }
.text-espresso { color: var(--espresso); }
.text-latte { color: var(--latte); }
.text-cream { color: var(--cream); }
.text-caramel { color: var(--caramel); }
.from-espresso { --tw-gradient-from: var(--espresso); }
.via-caramel\/30 { --tw-gradient-via: rgba(212, 165, 116, 0.3); }
.to-soft-black { --tw-gradient-to: var(--soft-black); }

/* Glassmorphism */
.glass-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.shadow-premium { box-shadow: var(--shadow-lg); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--caramel), var(--latte));
  color: var(--espresso) !important;
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
  min-height: 48px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(196, 165, 116, 0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--espresso) !important;
  transition: all var(--transition);
  min-height: 44px;
}

.btn-icon {
  @apply flex items-center justify-center rounded-xl;
  width: 48px; height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.btn-icon:hover { background: var(--latte); color: var(--espresso); }

/* Inputs */
.input-field, .select-field {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus, .select-field:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.25);
}
.label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; color: var(--espresso); }

/* Admin tables */
.admin-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 12px; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border); }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.admin-table tr:hover td { background: rgba(245, 230, 211, 0.4); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-amber { background: #fef3c7; color: #92400e; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 1.75rem; font-weight: 600; color: var(--espresso); }

/* Ripple effect */
.ripple { position: relative; overflow: hidden; }
.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 10%, transparent 10%);
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
  pointer-events: none;
}
.ripple:active::after { transform: scale(0); opacity: 1; transition: 0s; }

/* POS Layout */
.pos-layout { display: grid; grid-template-columns: 72px 1fr 380px; height: 100vh; overflow: hidden; }
@media (max-width: 1280px) { .pos-layout { grid-template-columns: 64px 1fr 340px; } }
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .pos-sidebar { display: none; }
  .pos-cart { position: fixed; bottom: 0; left: 0; right: 0; max-height: 50vh; z-index: 50; }
}

.pos-sidebar {
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(26, 15, 10, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 8px;
}
.pos-nav-item {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  color: var(--espresso);
  opacity: 0.55;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.25rem;
  border: none;
  background: transparent;
}
.pos-nav-item:hover, .pos-nav-item.active {
  background: rgba(212, 165, 116, 0.25);
  color: var(--espresso);
  opacity: 1;
  transform: scale(1.05);
}

/* Product cards */
.product-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.product-card:active { transform: scale(0.97); }
.product-card .product-img {
  aspect-ratio: 1;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(196,165,116,0.2), rgba(212,165,116,0.3));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.product-card .product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card.favorite::before {
  content: '♥';
  position: absolute;
  top: 8px; right: 8px;
  color: #e74c3c;
  font-size: 14px;
}

/* Category tabs */
.category-tab {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}
.category-tab.active {
  background: var(--espresso);
  color: var(--cream);
}
.category-tab:not(.active):hover { background: rgba(44, 24, 16, 0.06); }

/* Cart */
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-primary);
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.qty-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.qty-btn:hover { background: var(--latte); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 15, 10, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}
.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.modifier-option {
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.modifier-option.selected {
  border-color: var(--caramel);
  background: rgba(212, 165, 116, 0.15);
  font-weight: 600;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 14px 20px;
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--espresso);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 280px;
}
.toast.success { border-left: 4px solid #27ae60; }
.toast.error { border-left: 4px solid #e74c3c; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-error { background: #fde8e8; color: #c0392b; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* KDS */
.kds-column { min-height: calc(100vh - 80px); }
.kds-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--caramel);
  animation: pulse-border 2s infinite;
}
.kds-card.priority { border-left-color: #e74c3c; animation: pulse-urgent 1s infinite; }
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(212, 165, 116, 0); }
}
@keyframes pulse-urgent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

.animate-fade-in { animation: fadeIn 0.5s ease; }

/* Online shop — mobile bottom navigation */
.shop-body {
  padding-bottom: 0;
}
@media (max-width: 767px) {
  .shop-body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .shop-footer {
    margin-bottom: 0;
  }
}
.shop-main {
  min-height: 50vh;
}
.shop-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(26, 15, 10, 0.08);
}
.shop-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.2s, background 0.2s;
  min-height: 52px;
  touch-action: manipulation;
}
.shop-bottom-nav-item:hover,
.shop-bottom-nav-item.active {
  color: var(--espresso);
  background: rgba(212, 165, 116, 0.18);
}
.shop-bottom-nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.shop-bottom-nav-label {
  letter-spacing: 0.02em;
}
.shop-bottom-nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--espresso);
  color: var(--cream);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cart-drawer .pb-safe {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* Shop cart — order type tabs & forms */
.shop-cart-checkout {
  max-height: 55vh;
  overflow-y: auto;
}
.shop-order-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  min-height: 40px;
}
.shop-order-tab.active {
  border-color: var(--caramel);
  background: rgba(212, 165, 116, 0.2);
  color: var(--espresso);
}
.shop-order-form {
  animation: fadeIn 0.2s ease;
}
.shop-table-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}
.shop-table-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
}
.shop-table-chip:hover:not(.disabled) {
  border-color: var(--caramel);
}
.shop-table-chip.selected {
  border-color: var(--caramel);
  background: rgba(212, 165, 116, 0.2);
}
.shop-table-chip.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.shop-table-chip-label {
  font-size: 0.875rem;
  font-weight: 600;
}
.shop-table-chip-meta {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: capitalize;
}

.shop-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
}
.shop-qty-control .qty-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 1.1rem;
}
.shop-qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.shop-captcha-question {
  flex-shrink: 0;
  min-width: 5.5rem;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(212, 165, 116, 0.2);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}
.shop-captcha-refresh {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
}
.shop-captcha-refresh:hover {
  background: var(--latte);
}

/* Shop header — social links */
.shop-social-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.shop-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--espresso);
  background: rgba(44, 24, 16, 0.06);
  border: 1px solid var(--border);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
}
.shop-social-link:hover {
  color: var(--cream);
  background: var(--espresso);
  border-color: var(--espresso);
  transform: translateY(-1px);
}
.shop-social-link svg {
  width: 18px;
  height: 18px;
}

/* Shop home — BrewRewards banner */
.brew-rewards-card {
  background: linear-gradient(135deg, var(--espresso) 0%, #3D2314 55%, var(--soft-black) 100%);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(196, 165, 116, 0.25);
  position: relative;
  overflow: hidden;
}
.brew-rewards-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(196, 165, 116, 0.35) 0%, transparent 55%);
  pointer-events: none;
}
.brew-rewards-card > * {
  position: relative;
  z-index: 1;
}
.brew-rewards-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.brew-rewards-title {
  color: var(--cream);
}
.brew-rewards-text {
  color: rgba(245, 230, 211, 0.88);
  font-size: 1rem;
  line-height: 1.6;
}

/* Order type pills */
.order-type-pill {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all 0.2s;
}
.order-type-pill.active {
  border-color: var(--caramel);
  background: rgba(212, 165, 116, 0.2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--latte); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* Print receipt */
@media print {
  body * { visibility: hidden; }
  #receipt-print, #receipt-print * { visibility: visible; }
  #receipt-print { position: absolute; left: 0; top: 0; }
}
