/* ----------------------------------------
   File: assets/app.css
   استایل کلی سامانه فاکتور مکث لنت
----------------------------------------- */

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar: #0f172a;
  --sidebar-accent: #1e293b;
  --brand: #ffd166;
  --ring: rgba(37, 99, 235, 0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 18px rgba(20, 37, 63, 0.12);
  --shadow-lg: 0 10px 30px rgba(20, 37, 63, 0.16);
  --radius: 14px;
}

@font-face {
  font-family: 'FaNumAnjoman';
  src: url('fonts/FaNumAnjoman-Regular.ttf') format('truetype');
}

body {
  font-family: 'FaNumAnjoman', sans-serif;
  background: radial-gradient(1200px 600px at 80% -100px, #ffffff 20%, var(--bg) 60%, #eef2ff 100%);
  color: var(--text);
  direction: rtl;
  margin: 0;
  padding: 0;
}

/* اعمال فونت سراسری برای همه کنترل‌ها */
input, select, textarea, button, .btn, table, th, td, .chip, .badge, .sidebar, .content {
  font-family: 'FaNumAnjoman', sans-serif;
}

a { text-decoration: none; color: var(--primary); }
a:hover { text-decoration: underline; }

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 330px;
  background: linear-gradient(180deg, var(--sidebar), #0b1220 70%);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 18px;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 1000;
  border-left: 1px solid rgba(255,255,255,0.05);
}

.hamburger { display:none; position:fixed; top:12px; right:12px; z-index:1100; background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:8px 10px; box-shadow: var(--shadow-sm); }
.sidebar-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:900; }
.sidebar.open { transform: translateX(0); }
.sidebar { transform: translateX(0); transition: transform .2s ease; }

.sidebar .brand {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
  text-align: center;
  color: var(--brand);
}

.sidebar nav {
  flex-grow: 1;
}

.sidebar nav a {
  display: block;
  padding: 11px 14px;
  color: #cbd5e1;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
  background: transparent;
}
.sidebar nav a.active { position: relative; }
.sidebar nav a.active::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--sidebar-accent);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.sidebar .cta {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #111827;
  padding: 11px 12px;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  margin-top: 12px;
  box-shadow: var(--shadow-md);
}

.sidebar .logout {
  margin-top: auto;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

.content {
  flex: 1;
  padding: 26px 30px 40px;
}

/* ----------------------------------------
   Responsive
----------------------------------------- */
@media (max-width: 1024px) {
  .content { padding: 24px; }
}

@media (max-width: 768px) {
  .layout { display:block; }
  .hamburger { display:block; }
  .sidebar { position: fixed; width: 80%; max-width: 320px; height: 100vh; transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display:block; }
  .content { padding: 20px; margin-right: 0; }
}

/* Responsive improvements */
@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .tbl { display: block; overflow-x: auto; }
}

@media (min-width: 769px) {
  .content { margin-right: 30px; }
}

@media (max-width: 480px) {
  .content { padding: 14px; }
  .sidebar { padding: 14px; }
  .sidebar .brand { margin-bottom: 12px; }
}

h1, h2, h3 {
  color: var(--text);
  margin-top: 0;
}
h1 {
  font-size: 26px;
  letter-spacing: -0.3px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-md);
  text-align: center;
  border: 1px solid #eef2f7;
}

.card .k { font-size: 13px; color: #555; }
.card .v { font-size: 20px; font-weight: bold; color: #0077cc; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tbl th, .tbl td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.tbl thead {
  background: #f8fafc;
  font-weight: 700;
}

.btn {
  background: var(--primary);
  color: #fff;
  padding: 9px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-block;
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:hover { background: var(--primary-600); }
.btn:active { transform: translateY(1px); }

.btn.green { background: var(--success); }
.btn.orange { background: var(--warning); color:#111; }
.btn.blue { background: var(--primary); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.btn.outline { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: none; }

.alert {
  background: #e7f3ff;
  color: #004b8d;
  border: 1px solid #bcdffb;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.alert.error {
  background: #ffecec;
  border-color: #f5b5b5;
  color: #a10000;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid #eef2f7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
}

input, select, textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}
input::placeholder, textarea::placeholder { color: #9aa3b2; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

textarea { resize: vertical; }

.dropdown {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  position: absolute;
  z-index: 1000;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
}

.dropdown .row {
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.dropdown .row:hover {
  background: #f1f9ff;
}

.login-body {
  background: linear-gradient(135deg, #0077cc, #00b37a);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-box {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  width: 320px;
  text-align: center;
}

.login-logo {
  width: 70px;
  margin-bottom: 15px;
}

/* Toolbar / Filters */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.search-input { position:relative; }
.search-input input { padding-inline-start: 36px; }
.search-input .icon { position:absolute; inset-inline-start:10px; top:50%; transform:translateY(-50%); color:#9aa3b2; }

.tabs { display:flex; gap:8px; flex-wrap:wrap; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:8px 12px; background:#f3f4f6; color:#374151; border-radius:999px; font-weight:600; box-shadow: var(--shadow-sm); }
.chip.active { background:#e0e7ff; color:#1e40af; box-shadow: inset 0 0 0 2px #c7d2fe; }

.badge { display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; }
.badge.success { background:#dcfce7; color:#065f46; }
.badge.warning { background:#fef3c7; color:#92400e; }
.badge.info { background:#dbeafe; color:#1e40af; }

.tbl tbody tr:hover { background:#f9fbff; }

/* Invoice View */
.invoice-card { padding: 24px; }
.invoice-header-grid .muted { color: var(--muted); font-size: 13px; }
.note { margin-top:16px; padding:12px; background:#fffbeb; border:1px solid #fde68a; border-radius:10px; color:#92400e; }

/* Invoice top table */
.inv-top-table { width:100%; border-collapse: collapse; }
.inv-top-table th, .inv-top-table td { border:1px solid #e5e7eb; padding:10px 12px; vertical-align: top; background:#fff; }
.inv-top-table th { background:#f8fafc; text-align:right; width:33.33%; }
.inv-top-table .strong { font-weight:800; margin-bottom:6px; }
.inv-top-table .kv { display:flex; justify-content:space-between; gap:10px; margin-bottom:6px; }

/* Invoice totals table */
.inv-totals-table { width: 360px; margin-inline-start:auto; border-collapse: collapse; margin-top:16px; }
.inv-totals-table th, .inv-totals-table td { border:1px solid #e5e7eb; padding:8px 12px; background:#fff; }
.inv-totals-table th { background:#f8fafc; text-align:right; }
.inv-totals-table .total th, .inv-totals-table .total td { background:#e0f2fe; border-color:#bae6fd; font-weight:800; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: none; align-items: center; justify-content: center; z-index: 1200; padding: 16px; }
.modal-card { background: #fff; width: min(560px, 100%); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; font-weight: 800; }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid #e5e7eb; background: #fafafa; }
