/* North Indian Mandi POS Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Tiro+Devanagari+Hindi:ital@0;1&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-hindi: 'Tiro Devanagari Hindi', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --primary: #15803d; /* Agri Green */
  --primary-dark: #166534;
  --primary-light: #dcfce7;
  --accent-amber: #d97706; /* Wheat Gold */
  --accent-amber-light: #fef3c7;
  --bg-slate: #f8fafc;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-slate);
  color: #1e293b;
  margin: 0;
  padding: 0;
}

.font-hindi {
  font-family: var(--font-hindi);
}

.font-mono {
  font-family: var(--font-mono);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Badge & Card Animations */
.card-hover {
  transition: all 0.2s ease-in-out;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* Preview Paper Formatting on Screen */
#printableReceipt.format-58mm, #printableCommReceipt.format-58mm {
  width: 58mm;
  max-width: 58mm;
  margin: 0 auto;
  font-size: 10px;
  line-height: 1.25;
  padding: 8px 6px;
}
#printableReceipt.format-80mm, #printableCommReceipt.format-80mm {
  width: 80mm;
  max-width: 80mm;
  margin: 0 auto;
  font-size: 11px;
  line-height: 1.3;
  padding: 12px 10px;
}
#printableReceipt.format-a4, #printableCommReceipt.format-a4 {
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 20px;
}
#printableReceipt.format-a5, #printableCommReceipt.format-a5 {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  font-size: 11.5px;
  line-height: 1.35;
  padding: 16px;
}

/* Dual Copy Separation for A4 */
.dual-copy-divider {
  border-top: 2px dashed #94a3b8;
  margin: 20px 0;
  position: relative;
  text-align: center;
}
.dual-copy-divider::after {
  content: "✂️ यहाँ से काटें (Cut along dashed line) • किसान प्रति (Farmer Copy) ऊपर / आढ़ती प्रति (Merchant Copy) नीचे";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 0 10px;
  font-size: 9px;
  color: #64748b;
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #printableReceipt, #printableReceipt *,
  #printableCommReceipt, #printableCommReceipt * {
    visibility: visible;
  }
  #printableReceipt, #printableCommReceipt {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    background: #fff;
    color: #000;
  }
  #printableReceipt.format-58mm, #printableCommReceipt.format-58mm {
    width: 54mm !important;
    font-size: 9.5px !important;
  }
  #printableReceipt.format-80mm, #printableCommReceipt.format-80mm {
    width: 76mm !important;
    font-size: 11px !important;
  }
  #printableReceipt.format-a4, #printableCommReceipt.format-a4 {
    width: 100% !important;
    font-size: 12px !important;
  }
  #printableReceipt.format-a5, #printableCommReceipt.format-a5 {
    width: 100% !important;
    font-size: 11px !important;
  }
  .no-print {
    display: none !important;
  }
}

/* Thermal receipt styling on screen preview */
.thermal-receipt {
  font-family: 'JetBrains Mono', monospace;
  background: #fff;
  border: 1px dashed #94a3b8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* Pulse animation for Live Market indicators */
@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}
.live-pulse {
  animation: pulse-dot 2s infinite ease-in-out;
}

/* Hide scrollbar for smooth touch scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ---- Mobile fit: long dropdown options must not widen the page ---- */
select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.flex > select, .flex > input { min-width: 0; }
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px !important; } /* stops iPhone auto-zoom on focus */
  main { padding-left: .75rem !important; padding-right: .75rem !important; }
}


/* ---- Print: only the open slip, on one page (no repeats from the fixed popup) ---- */
@media print {
  html, body { height: auto !important; min-height: 0 !important; background: #fff !important; }
  body > *:not(:has(#printableReceipt)):not(:has(#printableCommReceipt)) { display: none !important; }
  body > *:has(#printableReceipt), body > *:has(#printableCommReceipt) {
    display: block !important; position: static !important; inset: auto !important;
    background: none !important; backdrop-filter: none !important; padding: 0 !important; overflow: visible !important;
  }
  body > *:has(#printableReceipt).hidden, body > *:has(#printableCommReceipt).hidden { display: none !important; }
  body > *:has(#printableReceipt) [class*="max-h-"], body > *:has(#printableCommReceipt) [class*="max-h-"] { max-height: none !important; overflow: visible !important; }
}

/* ---- grouped navigation & header menus ---- */
.nav-grp { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: #a7f3d0; font-weight: 700; white-space: nowrap;
  align-self: center; padding: 0 .2rem; }
.nav-grp-sep { margin-left: .35rem; padding-left: .6rem; border-left: 1px solid rgba(110, 231, 183, .35); }
details.hdr-menu > summary::-webkit-details-marker { display: none; }
.hdr-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 15rem; background: #fff; color: #0f172a; border-radius: .9rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25); border: 1px solid #e2e8f0; padding: .4rem; max-height: 75vh; overflow-y: auto; }
.hdr-panel-wide { min-width: 18rem; }
.hdr-panel a { display: block; padding: .42rem .65rem; border-radius: .55rem; font-size: .78rem; color: #0f172a; }
.hdr-panel a:hover { background: #ecfdf5; color: #065f46; }
.hdr-grp { font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: .5rem .65rem .15rem; }
@media print { details.hdr-menu { display: none !important; } }
@media (max-width: 640px) {
  .hdr-panel { position: fixed; left: .75rem; right: .75rem; min-width: 0; top: var(--hdr-menu-top, 7rem); max-height: calc(100vh - var(--hdr-menu-top, 7rem) - 1rem); }
}

/* ---- Enhanced Mobile Responsiveness & Accessibility ---- */
html, body {
  overflow-x: hidden;
}

@media (max-width: 640px) {
  /* Prevent modals from overflowing mobile viewport */
  .fixed.inset-0 > div:not(.bg-black):not(.bg-slate-900\/60) {
    max-height: calc(100vh - 2rem) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 1rem auto !important;
    width: calc(100% - 1.5rem) !important;
  }

  /* Smooth horizontal momentum scrolling */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch !important;
  }

  /* Touch target accessibility */
  button, .btn, input[type="button"], input[type="submit"] {
    min-height: 38px;
  }

  /* Safe bottom padding on devices with home indicator */
  body {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  /* Compact table cell padding for phone screens */
  table th, table td {
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }
}
