/* SENA Finance - styles (sidebar layout, Digikala red theme) */
:root { --dk-red: #e03d3d; --dk-red-dark: #c92c2c; }
body { background: #f5f6fa; }

/* ---- sidebar layout (same as central ERP) ---- */
.app-wrap { min-height: 100vh; }
.sidebar {
  width: 260px;
  background: #1f2937;
  color: #e5e7eb;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease, margin-right .25s ease;
}
.sidebar-brand { padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem 0; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  border-inline-start: 3px solid transparent;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active {
  background: rgba(224,61,61,.16);
  color: #fff;
  border-inline-start-color: var(--dk-red);
}
.sidebar-nav .nav-link i { width: 1.1rem; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { margin-left: 260px; min-height: 100vh; }
.app-topbar {
  background: linear-gradient(90deg, #fff 0%, #fffdf5 100%);
  border-bottom: 2px solid var(--dk-red);
  padding: .6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.app-topbar .fw-semibold { font-weight: 800; font-size: 1.02rem; }
.app-topbar .badge, .app-topbar .btn { border-radius: .6rem; }
.app-topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--dk-red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .app-main { margin-left: 0; margin-right: 260px; }
@media (max-width: 991.98px) {
  .sidebar { margin-left: -260px; }
  [dir="rtl"] .sidebar { margin-left: 0; margin-right: -260px; }
  .sidebar.show { margin-left: 0 !important; margin-right: 0 !important; box-shadow: 0 0 30px rgba(0,0,0,.35); }
  .app-main { margin-left: 0 !important; margin-right: 0 !important; }
}

/* ---- responsive tables on smaller screens ---- */
.table-responsive { -webkit-overflow-scrolling: touch; }
@media (max-width: 991.98px) {
  .table-responsive .table { min-width: 640px; }
  .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .form-control, .form-select { min-height: 44px; }
  .btn { padding-top: .45rem; padding-bottom: .45rem; }
}

/* ---- theme (Digikala) ---- */
.navbar { background: var(--dk-red) !important; }
.btn-primary { background-color: var(--dk-red); border-color: var(--dk-red); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--dk-red-dark) !important; border-color: var(--dk-red-dark) !important; }
.btn-outline-primary { color: var(--dk-red); border-color: var(--dk-red); }
.btn-outline-primary:hover { background-color: var(--dk-red); border-color: var(--dk-red); color: #fff; }
.text-primary { color: var(--dk-red) !important; }
.progress-bar { background-color: var(--dk-red); }
.form-control:focus, .form-select:focus { border-color: #f0a0a0; box-shadow: 0 0 0 .2rem rgba(224,61,61,.15); }
.card { border: 0; border-radius: .75rem; box-shadow: 0 1px 4px rgba(0,0,0,.06) !important; }
.card-header { background: #fff; border-bottom: 1px solid #eee; font-weight: 600; }
.card.bg-warning, .card.bg-success, .card.bg-info, .card.bg-secondary { border-radius: .75rem; box-shadow: 0 6px 16px rgba(0,0,0,.12) !important; }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table { font-size: .88rem; }
.table thead th { font-weight: 700; color: #4b5563; }
.btn { border-radius: .5rem; font-weight: 600; }
.form-control, .form-select { border-radius: .5rem; }
.badge { border-radius: .45rem; }
.alert { border-radius: .6rem; }
/* page headers: red accent bar (Digikala) */
h4.mb-3, h4.mb-4 { position: relative; padding-inline-start: .8rem; font-weight: 800; }
h4.mb-3::before, h4.mb-4::before { content: ''; position: absolute; inset-inline-start: 0; top: .2rem; bottom: .2rem; width: 4px; border-radius: 4px; background: var(--dk-red); }

/* ---- grouped submenus (Payments / Expenses -> Unapproved / Approved) ---- */
.nav-group { margin: .25rem 0; }
.nav-group-title {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 1.25rem .25rem;
  color: #8b9bb0; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.nav-group-title i { width: 1.1rem; text-align: center; color: #6b7c93; }
.sidebar-nav .nav-link.sub {
  padding-inline-start: 2.6rem;
  font-size: .88rem;
  color: #9fb0c3;
}
.sidebar-nav .nav-link.sub:hover { color: #fff; }
.sidebar-nav .nav-link.sub.active { color: #fff; font-weight: 600; }
[dir="rtl"] .text-end { text-align: left !important; }

/* Dari (RTL): Vazirmatn - consistent, readable Persian/Dari typeface */
[dir="rtl"] body,
[dir="rtl"] .form-control,
[dir="rtl"] .form-select,
[dir="rtl"] .form-label,
[dir="rtl"] .btn,
[dir="rtl"] .nav-link,
[dir="rtl"] .dropdown-item,
[dir="rtl"] .table,
[dir="rtl"] .modal-title,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea { font-family: 'Vazirmatn', 'Segoe UI', 'Helvetica Neue', Arial, Tahoma, sans-serif; }

/* Dari (RTL): direction-aware icons point the natural way (forward = left) */
[dir="rtl"] .bi-box-arrow-right,
[dir="rtl"] .bi-box-arrow-in-right { display: inline-block; transform: scaleX(-1); }

/* ---- smooth sidebar animations ---- */
.sidebar-nav .collapse { transition: height .3s cubic-bezier(.4, 0, .2, 1); }
.sidebar-nav .nav-link[data-bs-toggle="collapse"] .bi-chevron-down { transition: transform .3s ease; }
.sidebar-nav .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down { transform: rotate(90deg); }

/* ---- custom scrollbar (Digikala style) ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f2f4; }
::-webkit-scrollbar-thumb { background: #cfd3da; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--dk-red); }
* { scrollbar-width: thin; scrollbar-color: #cfd3da #f1f2f4; }
.sidebar-nav::-webkit-scrollbar-track, .app-sidebar::-webkit-scrollbar-track { background: #1f2937; }
.sidebar-nav::-webkit-scrollbar-thumb, .app-sidebar::-webkit-scrollbar-thumb { background: #4b5563; }
.sidebar-nav, .app-sidebar { scrollbar-color: #4b5563 #1f2937; }

/* ---- standard sign-in page (shared with ERP / shop) ---- */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(150deg, #fdf2f2 0%, #f5f6fa 55%, #f0f2f7 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(31, 41, 55, .14);
}
.login-icon {
  width: 64px; height: 64px; border-radius: 1rem;
  background: linear-gradient(135deg, var(--dk-red), var(--dk-red-dark));
  color: #fff; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 10px 22px rgba(224, 61, 61, .35);
}
.login-title { font-weight: 800; font-size: 1.15rem; color: #1c2333; margin-bottom: 2px; }
.login-sub { color: #6b7484; font-size: .85rem; }
.login-lang { margin-top: 14px; font-size: .82rem; }
.login-lang a { color: #6b7484; text-decoration: none; margin: 0 6px; }
.login-lang a:hover { color: var(--dk-red); }

/* ---- standard dashboard stat cards ---- */
.stat-card {
  background: #fff; border-radius: .8rem; border: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 1rem 1.1rem;
  display: flex; align-items: center; gap: 14px;
  height: 100%;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: .8rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; flex-shrink: 0;
}
.stat-value { font-weight: 800; font-size: 1.5rem; line-height: 1.1; color: #1c2333; }
.stat-label { color: #6b7484; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* ---- custom confirmation modal (same as central ERP) ---- */
.cfm-content { border: 0; border-radius: 1rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.cfm-icon-wrap { position: relative; display: inline-flex; }
.cfm-icon { position: relative; width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #fdecec; color: #e03d3d; font-size: 2rem; z-index: 1; }
.cfm-icon::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 2px dashed rgba(224,61,61,.35); }
.cfm-title { font-weight: 800; font-size: 1.05rem; color: #1c2333; }
.cfm-cancel { border-radius: 999px; padding: .5rem 1.4rem; font-weight: 600; border: 1px solid #dee2e6; color: #495057; background: #f8f9fa; }
.cfm-cancel:hover { background: #e9ecef; }
.cfm-ok { border-radius: 999px; padding: .5rem 1.7rem; font-weight: 700; color: #fff; border: none;
  background: linear-gradient(135deg, #e03d3d, #c92c2c); box-shadow: 0 6px 16px rgba(224,61,61,.35); }
.cfm-ok:hover { filter: brightness(1.08); }

/* ---- responsive (mobile-first) ---- */
@media (max-width: 767px) {
  .card-body { overflow-x: auto; }
  .table { font-size: .8rem; }
}
