/* ============================================================
   Transport Claims Manager — Design System
   "Waybill ledger" identity for a dense back-office data tool
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
  --navy-950: #001453;   /* deepest ink / on-primary-fixed */
  --navy-900: #00288e;   /* primary */
  --navy-700: #1e40af;   /* primary-container / hover */
  --paper:    #fbf8ff;   /* surface */
  --surface:  #ffffff;   /* surface-container-lowest */
  --ink:      #1a1b22;   /* on-surface */
  --muted:    #444653;   /* on-surface-variant */
  --border:   #c4c5d5;   /* outline-variant */
  --amber:    #872d00;   /* tertiary — warm accent for badges/ticket motif */
  --amber-dk: #611e00;   /* on-tertiary-fixed */
  --amber-bg: #ffdbce;   /* tertiary-fixed */
  --success:  #1b8a5a;
  --success-bg: #e3f5ea;
  --danger:   #ba1a1a;   /* error */
  --danger-bg: #ffdad6;  /* error-container */
  --primary-bg: #dde1ff; /* primary-fixed — light tint for hovers/chips */

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 20, 83, 0.06), 0 1px 3px rgba(0, 20, 83, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 20, 83, 0.10), 0 2px 4px rgba(0, 20, 83, 0.06);
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

a { color: var(--navy-900); text-decoration: none; }
a:hover { color: var(--navy-700); }

/* ---------- Numbers: tabular alignment for amounts / codes ---------- */
.num, td.num, .table td.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  direction: ltr;
  text-align: right;
  font-weight: 500;
}

/* ---------- Top bar ---------- */
.app-topbar {
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  box-shadow: var(--shadow-md);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff !important;
}

.app-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

.app-nav .nav-link {
  color: rgba(255,255,255,0.75) !important;
  font-weight: 500;
  padding: 0.5rem 0.9rem !important;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav .nav-link:hover { color: #fff !important; background: rgba(255,255,255,0.08); }
.app-nav .nav-link.active { color: #fff !important; background: rgba(255,219,206,0.22); }

.app-user-chip {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  background: rgba(255,255,255,0.08);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: #fff;
}

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #24784f; border-color: #24784f; }

.btn-outline-secondary, .btn-outline-primary {
  border-color: var(--border);
  color: var(--navy-900);
}
.btn-outline-secondary:hover, .btn-outline-primary:hover {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}

.btn-outline-danger { color: var(--danger); border-color: #f0c6c6; }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.card .card-body { padding: 1.4rem; }

.section-title {
  font-weight: 700;
  color: var(--navy-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}
.section-title .icon { color: var(--amber); }

/* ---------- Waybill / ticket motif (signature element) ---------- */
.ticket-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.ticket-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: repeating-linear-gradient(
    to bottom,
    var(--amber) 0 10px,
    transparent 10px 18px
  );
}
.ticket-tag {
  position: absolute;
  top: 0.9rem;
  inset-inline-end: 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--border);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  direction: ltr;
}

/* ---------- Stat tiles ---------- */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-tile::after {
  content: "";
  position: absolute;
  inset-inline-end: -18px;
  top: -18px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--stat-accent, var(--navy-900));
  opacity: 0.12;
}
.stat-tile .stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.stat-tile .stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
}
.stat-tile.accent-amber   { --stat-accent: var(--amber); }
.stat-tile.accent-success { --stat-accent: var(--success); }
.stat-tile.accent-danger  { --stat-accent: var(--danger); }
.stat-tile.accent-navy    { --stat-accent: var(--navy-700); }

/* ---------- Forms ---------- */
.form-label {
  font-weight: 600;
  color: var(--navy-900);
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
}
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: 0.55rem 0.8rem;
  font-size: 0.94rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy-900);
  box-shadow: 0 0 0 3px rgba(0,40,142,0.16);
}
.form-text { color: var(--muted); font-size: 0.8rem; }

fieldset.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem 0.6rem;
  margin-bottom: 1.2rem;
}
fieldset.form-section legend {
  float: none;
  width: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--amber-dk);
  background: var(--amber-bg);
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  margin-inline-start: -0.2rem;
}

/* ---------- Segmented status control (replaces plain radios) ---------- */
.status-segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: var(--paper);
  gap: 2px;
}
.status-segmented input[type="radio"] { display: none; }
.status-segmented label {
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.status-segmented input#statusInProgress:checked ~ label[for="statusInProgress"],
.status-segmented input[value="InProgress"]:checked + label {
  background: var(--amber-bg); color: var(--amber-dk);
}
.status-segmented input[value="Deposited"]:checked + label {
  background: var(--success-bg); color: var(--success);
}
.status-segmented input[value="NonPayable"]:checked + label {
  background: var(--danger-bg); color: var(--danger);
}

/* ---------- Badges ---------- */
.badge { font-weight: 600; padding: 0.4em 0.75em; border-radius: 999px; }
.badge-status-inprogress { background: var(--amber-bg); color: var(--amber-dk); }
.badge-status-deposited  { background: var(--success-bg); color: var(--success); }
.badge-status-nonpayable { background: var(--danger-bg); color: var(--danger); }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}
.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
  border-bottom-width: 1px;
  border-color: var(--border);
  background: var(--paper);
  padding: 0.75rem 0.9rem;
}
.table tbody td {
  padding: 0.8rem 0.9rem;
  border-color: var(--border);
  vertical-align: middle;
}
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover { background: var(--primary-bg); }

.person-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ---------- Filter chips ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-bg);
  color: var(--navy-900);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.filter-chip button {
  border: none;
  background: none;
  color: inherit;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  opacity: 0.5;
}
.empty-state .empty-title {
  color: var(--navy-900);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  top: 1rem;
  inset-inline-end: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 360px;
}
.app-toast {
  background: var(--surface);
  border-inline-start: 4px solid var(--success);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--navy-900);
  font-size: 0.9rem;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-toast.fading { animation: toast-out 0.25s ease forwards; }
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Jalali date hint ---------- */
.jalali-hint {
  font-size: 0.78rem;
  color: var(--amber-dk);
  margin-top: 0.25rem;
  font-weight: 600;
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--surface);
}

/* ---------- Auth / Login page (Material 3 "Stitch" style) ---------- */
.auth-shell {
  position: relative;
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--paper);
  padding: 3rem 1.5rem;
  border-radius: var(--radius-lg);
  margin: -1.5rem -0.75rem;
}
.auth-bg-decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
}
.auth-blob.b1 { top: -80px; inset-inline-end: -80px; width: 320px; height: 320px; background: rgba(0,40,142,0.08); }
.auth-blob.b2 { top: 45%; inset-inline-start: -160px; width: 420px; height: 420px; background: rgba(80,95,118,0.10); }
.auth-blob.b3 { bottom: -40px; inset-inline-end: 20%; width: 260px; height: 260px; background: rgba(135,45,0,0.06); }
.auth-dots {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: radial-gradient(var(--navy-900) 0.6px, transparent 0.6px);
  background-size: 24px 24px;
}

.auth-main { position: relative; z-index: 1; width: 100%; max-width: 420px; }

.auth-brand { text-align: center; margin-bottom: 2rem; }
.auth-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--navy-900);
  color: #fff;
  margin-bottom: 1rem;
  box-shadow: 0 10px 24px rgba(0,40,142,0.22);
}
.auth-brand-icon .material-symbols-outlined { font-size: 32px; }
.auth-brand h1 { font-size: 1.3rem; font-weight: 700; color: var(--navy-900); margin-bottom: 0.2rem; }
.auth-brand p { color: var(--muted); font-size: 0.9rem; margin: 0; }

.auth-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.8rem 1.7rem;
}

.field-group { position: relative; }
.field-group .field-icon {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 1rem;
  display: flex;
  align-items: center;
  color: var(--muted);
  pointer-events: none;
}
.field-group:focus-within .field-icon { color: var(--navy-900); }
.field-group .field-input {
  width: 100%;
  height: 3.4rem;
  padding-inline-start: 2.9rem;
  padding-inline-end: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-group .field-input:focus {
  border-color: var(--navy-900);
  box-shadow: 0 0 0 3px rgba(0,40,142,0.14);
}
.field-group .field-label {
  position: absolute;
  top: 1rem;
  inset-inline-start: 2.9rem;
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
  transition: transform 0.15s ease, font-size 0.15s ease, color 0.15s ease;
  background: transparent;
  transform-origin: right center;
}
.field-group .field-input:focus + .field-label,
.field-group .field-input:not(:placeholder-shown) + .field-label {
  transform: translateY(-1.55rem) scale(0.82);
  color: var(--navy-900);
  background: var(--surface);
  padding: 0 0.3rem;
}
.field-toggle {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-end: 0.9rem;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.field-toggle:hover { color: var(--navy-900); }

.auth-submit {
  width: 100%;
  height: 3.4rem;
  background: var(--navy-900);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 8px 20px rgba(0,40,142,0.18);
  transition: background 0.15s ease, transform 0.06s ease;
  cursor: pointer;
}
.auth-submit:hover { background: var(--navy-700); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: 0.75; cursor: progress; }

.auth-side-panel {
  position: fixed;
  top: 0; bottom: 0;
  left: 0;
  width: 32%;
  padding: 1.5rem;
  z-index: 0;
  pointer-events: none;
}
.auth-side-panel-inner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-950) 60%, var(--amber-dk));
  box-shadow: var(--shadow-md);
}
.auth-side-panel-inner .grid-icons {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
  padding: 3rem 1.6rem;
  transform: rotate(-14deg) scale(1.35);
  opacity: 0.28;
}
.auth-side-panel-inner .grid-icons .material-symbols-outlined {
  color: #fff;
  font-size: 26px;
}
.auth-side-panel-inner .panel-caption {
  position: absolute;
  bottom: 12%;
  inset-inline-start: 0;
  inset-inline-end: 0;
  text-align: center;
  color: #fff;
  padding: 0 2rem;
}
.auth-side-panel-inner .panel-caption .material-symbols-outlined {
  font-size: 34px;
  margin-bottom: 0.5rem;
}
.auth-side-panel-inner .panel-caption p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0.3rem 0 0;
}

@media (max-width: 1023px) {
  .auth-side-panel { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .card .card-body { padding: 1.1rem; }
  .stat-tile .stat-value { font-size: 1.4rem; }
}

/* ---------- Accessibility: visible focus ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--navy-900);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
