/* ==============================================================================
   حسابدار هرمس - Hermes Modem Accounting
   Styles & Mobile-First PWA Styling
   ============================================================================== */

/* فونت وزیرمتن به‌صورت محلی (بدون نیاز به گوگل فونتس) */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/fonts/vazirmatn-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/vendor/fonts/vazirmatn-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/vendor/fonts/vazirmatn-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/vendor/fonts/vazirmatn-900.woff2') format('woff2');
}

:root {
  --font-vazir: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-card-border: #e2e8f0;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-vazir);
  direction: rtl;
  text-align: right;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  min-height: 100vh;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

/* Persian typography adjustments */
input, select, textarea, button {
  font-family: inherit;
}

/* Safe area for Android and iPhone gesture bars */
.pb-safe {
  padding-bottom: calc(5rem + var(--safe-bottom));
}

.bottom-nav-container {
  padding-bottom: var(--safe-bottom);
}

/* 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;
}

/* Scanner Viewfinder Box Animation */
.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #2563eb;
  box-shadow: 0 0 12px #2563eb, 0 0 20px #3b82f6;
  animation: scanLaser 2.2s infinite ease-in-out;
}

@keyframes scanLaser {
  0% {
    top: 5%;
    opacity: 0.2;
  }
  50% {
    top: 92%;
    opacity: 1;
  }
  100% {
    top: 5%;
    opacity: 0.2;
  }
}

/* Pulse badge animation */
@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.pulse-sync {
  animation: pulseGlow 1.8s infinite;
}

/* Active Bottom Nav Item */
.nav-item.active {
  color: #2563eb;
}

.nav-item.active .nav-icon-bg {
  background-color: #eff6ff;
  color: #2563eb;
}

/* Light theme comprehensive styling */
.bg-darkbg {
  background-color: #f8fafc !important;
}
.bg-darkcard {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
.border-darkborder {
  border-color: #e2e8f0 !important;
}

/* Soft card shadow */
.card-soft {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}

/* Form input focus styles */
input, select, textarea {
  color: #0f172a;
}

input:focus, select:focus, textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important;
}

/* Modal animation */
.modal-backdrop {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.2s ease;
}

/* Number inputs remove spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ------------------------------------------------------------------------------
   PRINT STYLES FOR INVOICES (A4 / Thermal Printable)
   ------------------------------------------------------------------------------ */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  /* Hide everything except printable invoice */
  .no-print,
  #bottomNav,
  #topBar,
  #offlineBar,
  #toastContainer,
  .btn-action,
  .modal-actions {
    display: none !important;
  }

  #invoiceModal {
    position: static !important;
    inset: auto !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
  }

  #invoicePrintArea {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    color: #000 !important;
    background: #fff !important;
  }

  #invoicePrintArea * {
    color: #000 !important;
    border-color: #999 !important;
  }

  .print-border {
    border: 1px solid #000 !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 6px 8px !important;
    text-align: right !important;
  }

  th {
    background-color: #f2f2f2 !important;
  }
}
