/* ==========================================================================
   سامانه مدیریت دفتر وکالت - استایل‌های مینیمال، دارک‌مود و تایپوگرافی زیبا
   ========================================================================== */

/* بارگذاری محلی فونت وزیرمتن با تمام وزن‌ها برای نمایش فوق‌العاده سریع و آفلاین */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-focus: #475569;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
}

html.dark {
  --bg-app: #090d16;
  --bg-card: #0f172a;
  --border-subtle: #1e293b;
  --border-focus: #94a3b8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 15.5px;
}

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: rtl;
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Persian typography enhancements - crisp & comfortable font sizes */
.text-\[9px\] {
  font-size: 0.72rem !important;
}

.text-\[10px\] {
  font-size: 0.78rem !important;
}

.text-\[11px\] {
  font-size: 0.84rem !important;
}

.text-xs {
  font-size: 0.88rem !important;
  line-height: 1.5 !important;
}

.text-sm {
  font-size: 0.98rem !important;
  line-height: 1.55 !important;
}

/* Persian digits formatting */
.font-number, .fa-digits {
  font-feature-settings: "ss01";
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Minimalist Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Form Controls with Dark Mode Support */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2.5px rgba(100, 116, 139, 0.12);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-light);
  font-size: 0.88rem;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: left 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.1em 1.1em;
  padding-left: 2rem;
}

/* Toman Live Helper */
.toman-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  margin-top: 0.35rem;
}

/* Mobile & PWA Optimization */
.modal-dialog {
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 12px));
  }
  
  .modal-dialog {
    margin: 0;
    max-width: 100% !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 85vh;
  }
}

.mobile-bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.touch-press:active {
  opacity: 0.7;
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .no-print, header, nav, #pwaBanner, #pwaInstallBtn, #themeToggleBtn {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .print-border {
    border: 1px solid #666 !important;
  }
}

/* Jalali Datepicker Styles */
jdp-container {
  font-family: 'Vazirmatn', sans-serif !important;
  direction: rtl !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid var(--border-subtle) !important;
  max-width: 94vw !important;
  z-index: 99999 !important;
}

jdp-container * {
  font-family: 'Vazirmatn', sans-serif !important;
}

html.dark jdp-container {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark jdp-container * {
  color: #f8fafc !important;
}

html.dark jdp-container .selected {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
