/* ═══════════════════════════════════════════════════════════════
   کافه دیوان (Divan Coffee) - Design System & UI Overhaul
   ═══════════════════════════════════════════════════════════════ */

/* Multiple Bulletproof Font Imports for Persian Typography */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
  
  /* Luxury Dark Coffeehouse Palette */
  --cafe-bg: #110e0b;
  --cafe-surface: #18130e;
  --cafe-card: #221a13;
  --cafe-card-hover: #2b2118;
  --cafe-border: #382a1d;
  --cafe-border-glow: #d4a373;
  
  --cafe-gold: #d4a373;
  --cafe-gold-light: #faedcd;
  --cafe-gold-dark: #b08154;
  --cafe-bronze: #c58f5e;
  
  --cafe-amber: #e09f3e;
  --cafe-cream: #fefae0;
  --cafe-text: #f5ede0;
  --cafe-muted: #a39482;
  
  --cafe-success: #2a9d8f;
  --cafe-info: #457b9d;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(212, 163, 115, 0.22);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--cafe-bg);
  color: var(--cafe-text);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--cafe-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--cafe-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cafe-gold);
}

/* Glass Panels */
.glass-panel {
  background: rgba(24, 19, 14, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--cafe-border);
}

.glass-card {
  background: linear-gradient(155deg, rgba(34, 26, 19, 0.92), rgba(24, 18, 13, 0.96));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--cafe-border);
  border-radius: var(--radius-lg);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  border-color: rgba(212, 163, 115, 0.55);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow), var(--shadow-card);
}

/* Text Gradients */
.text-gold-gradient {
  background: linear-gradient(135deg, #faedcd 0%, #d4a373 60%, #b08154 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #d4a373 0%, #b08154 100%);
  color: #120d08;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.22s ease;
  box-shadow: 0 4px 14px rgba(212, 163, 115, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #faedcd 0%, #c58f5e 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 163, 115, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--cafe-text);
  border: 1px solid var(--cafe-border);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.22s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--cafe-gold);
  color: #fff;
}

/* Option Cards (Interactive Radio Selection with Visible Checked State) */
.option-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #1c150f;
  border: 1.5px solid #382a1d;
  color: #d1c4b4;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.option-pill:hover {
  border-color: rgba(212, 163, 115, 0.6);
  background: #241c14;
  color: #fff;
}

.option-pill.active {
  border-color: #d4a373 !important;
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.22), rgba(176, 129, 84, 0.28)) !important;
  color: #fff !important;
  box-shadow: 0 0 14px rgba(212, 163, 115, 0.3);
}

.option-pill.active .check-icon {
  opacity: 1 !important;
  transform: scale(1) !important;
}

.option-pill .check-icon {
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s ease;
  color: #d4a373;
}

/* Table Selection Badges */
.table-btn {
  padding: 8px 10px;
  border-radius: 10px;
  background: #1e1711;
  border: 1.5px solid #382a1d;
  color: #c9bcad;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-btn:hover {
  border-color: #d4a373;
  color: #fff;
}

.table-btn.active {
  border-color: #d4a373;
  background: #d4a373;
  color: #120d08;
  box-shadow: 0 0 10px rgba(212, 163, 115, 0.4);
}

/* Payment Method Cards */
.payment-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #1e1711;
  border: 1.5px solid #382a1d;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-card:hover {
  border-color: rgba(212, 163, 115, 0.6);
}

.payment-card.active {
  border-color: #d4a373;
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.2), rgba(34, 26, 19, 0.9));
  box-shadow: 0 0 15px rgba(212, 163, 115, 0.25);
}

.payment-card.active .pay-radio-dot {
  background: #d4a373;
  border-color: #d4a373;
}

.pay-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #5a4635;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

/* Order Type Pills */
.order-type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #1e1711;
  border: 1.5px solid #382a1d;
  color: #c9bcad;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s ease;
}

.order-type-btn:hover {
  border-color: #d4a373;
  color: #fff;
}

.order-type-btn.active {
  border-color: #d4a373;
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.22), rgba(176, 129, 84, 0.28));
  color: #fff;
  box-shadow: 0 0 14px rgba(212, 163, 115, 0.3);
}

/* Uniform Menu Card Structure */
.menu-item-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.menu-item-card .card-title {
  min-height: 48px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.menu-item-card .card-desc {
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

/* Bump Animation */
@keyframes cartBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.animate-bump {
  animation: cartBump 0.38s ease-in-out;
}

/* Poetic quote fade */
.poem-transition {
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.poem-fading {
  opacity: 0;
  transform: translateY(-6px);
}

/* Modal Blur */
.modal-backdrop {
  background: rgba(10, 7, 5, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Mobile Phone Simulator for SMS */
.phone-mockup {
  width: 320px;
  height: 520px;
  border-radius: 38px;
  border: 7px solid #2d241c;
  background: #17120e;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.phone-mockup .notch {
  width: 110px;
  height: 20px;
  background: #2d241c;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.phone-screen {
  padding: 34px 14px 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sms-bubble {
  background: #251c14;
  border: 1px solid #4a3725;
  color: #f5ede0;
  padding: 12px 14px;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  max-width: 92%;
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeInBubble 0.3s ease-out;
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Thermal Printer 80mm Receipt Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #thermalReceiptModal, #thermalReceiptModal * {
    visibility: visible;
  }
  #thermalReceiptModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    background: #fff !important;
    color: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .no-print {
    display: none !important;
  }
  .receipt-box {
    width: 78mm;
    margin: 0 auto;
    font-size: 11px;
    line-height: 1.4;
    color: #000 !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ========================================================
   Collapsible Folder Cards & Accordion UI (پوشه‌بندی و آکاردئون هوشمند)
   ======================================================== */
.folder-card {
  background: #18130e;
  border: 1px solid #382a1d;
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.folder-card:hover {
  border-color: rgba(212, 163, 115, 0.4);
}

.folder-card.is-open {
  border-color: rgba(212, 163, 115, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.folder-header {
  padding: 13px 18px;
  background: linear-gradient(90deg, #1d1712, #241c14);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 0.2s ease;
}

.folder-header:hover {
  background: linear-gradient(90deg, #241c14, #2b2118);
}

.folder-chevron {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.folder-card.is-open .folder-chevron {
  transform: rotate(180deg);
}

.folder-body {
  transition: opacity 0.25s ease, max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.folder-card.is-collapsed .folder-body {
  display: none !important;
}

.folder-card.is-open .folder-body {
  display: block;
}

/* Kanban Collapsible Column Styles */
.kanban-col {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kanban-col.is-collapsed {
  max-height: 52px !important;
  overflow: hidden !important;
}

.kanban-col.is-collapsed .kanban-col-body {
  display: none !important;
}

.kanban-col.is-collapsed .col-chevron {
  transform: rotate(-90deg);
}

/* ========================================================
   Mobile Responsiveness & Viewport Enhancements (بهینه‌سازی کامل نسخه موبایل)
   ======================================================== */
@media (max-width: 640px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  .phone-mockup {
    width: 100% !important;
    max-width: 310px !important;
    height: 480px !important;
  }

  .modal-backdrop {
    padding: 10px !important;
  }

  .modal-backdrop > div {
    max-height: 94vh !important;
    border-radius: 24px !important;
  }

  .folder-header {
    padding: 11px 14px !important;
  }

  .folder-body {
    padding: 10px 10px !important;
  }

  /* Cart Drawer Mobile */
  #cartDrawer {
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Sticky Category Nav */
  #categoryNav {
    top: 60px !important;
  }

  /* KDS Kanban Column Heights on Mobile */
  .kanban-col {
    max-height: 520px !important;
  }

  /* Table Horizontal Scrolling Indication */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Clean Touch Targets on mobile */
  .btn-primary, .btn-secondary {
    min-height: 38px;
  }
}


