/* PettyCash Tools Shared Styles */
:root {
  --bg-card: #ffffff;
  --bg-page: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --radius: 1rem;
}
.dark {
  --bg-card: #1e293b;
  --bg-page: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
}

body {
  background: var(--bg-page);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
}

/* Smooth transitions */
* { transition: background-color 0.15s ease, border-color 0.15s ease; }

/* Print styles */
@media print {
  @page { size: A4; margin: 0; }
  .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .preview-container { box-shadow: none !important; border: none !important; overflow: visible !important; background: #fff !important; padding: 0 !important; }
  nav, aside, .action-bar, .sidebar, .tool-form { display: none !important; }
  main { padding: 0 !important; }
  .paper {
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
    padding: 10mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .invoice-paper { transform: none !important; }
  .invoice-paper * { page-break-inside: avoid; }
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* Preview paper */
.paper {
  background: #fff;
  color: #1e293b;
  width: 100%;
  max-width: 210mm;
  min-height: auto;
  padding: 12mm;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Invoice compact layout */
.invoice-paper .preview-table th,
.invoice-paper .preview-table td {
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
}
.invoice-paper h1 { font-size: 1.6rem; }
.invoice-paper h2 { font-size: 1.1rem; }
.invoice-paper h3 { font-size: 0.95rem; }
.invoice-paper p, .invoice-paper span, .invoice-paper div { font-size: 0.82rem; }
.invoice-paper .stamp-circle {
  width: 4rem;
  height: 4rem;
  font-size: 0.65rem;
}

/* Voucher compact layout */
.voucher-paper .preview-table th,
.voucher-paper .preview-table td {
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
}
.voucher-paper h1 { font-size: 1.5rem; }
.voucher-paper h2 { font-size: 1.1rem; }
.voucher-paper p, .voucher-paper span, .voucher-paper div { font-size: 0.82rem; }

/* RTL specific */
[dir="rtl"] .ltr-field { direction: rtl; }
[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select { text-align: right; }
[dir="rtl"] .paper { direction: rtl; }

/* Table styling inside preview */
.preview-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.preview-table th, .preview-table td { border: 1px solid #e2e8f0; padding: 0.5rem; text-align: start; font-size: 0.875rem; }
.preview-table th { background: #f1f5f9; }

/* Empty states */
.empty-state { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--text-muted); }

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { opacity: 0.95; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 500;
}
.btn-secondary:hover { background: var(--primary-50); color: var(--primary); }

/* Form elements */
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.875rem;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Animation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.dark .skeleton { background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%); }
