/* SENA ERP - application styles (sidebar layout) */
body { background: #f5f6fa; }

/* ---- Sidebar layout ---- */
.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: .7rem;
  padding: .62rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  border-inline-start: 3px solid transparent;
  font-size: .92rem;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active {
  background: rgba(13,110,253,.18);
  color: #fff;
  border-inline-start-color: #0d6efd;
}
.sidebar-nav .nav-link i { width: 1.1rem; text-align: center; }
.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; }
.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;
}

/* RTL: sidebar moves to the right, content gets a right margin */
[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; }
}

/* tracking map: shorter on phones so the status table stays visible */
@media (max-width: 767px) {
  .trk-map { height: 46vh !important; }
  .leaflet-popup-content { max-width: calc(100vw - 30px) !important; }
}

/* ---- misc ---- */
.card { border: 0; border-radius: .6rem; }
.card-header { background: #fff; border-bottom: 1px solid #eee; font-weight: 600; }

[dir="rtl"] .dropdown-menu-end { left: 0 !important; right: auto !important; }
[dir="rtl"] .text-end { text-align: left !important; }

.table > :not(caption) > * > * { padding: .6rem .75rem; }

.cust-photo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: .5rem;
  border: 1px solid #dee2e6;
}
.cust-photo-lg { width: 90px; height: 90px; object-fit: cover; border-radius: .6rem; border: 1px solid #dee2e6; }

/* ---- Digikala theme (red accents) ---- */
:root { --dk-red: #e03d3d; --dk-red-dark: #c92c2c; }

.navbar { background: var(--dk-red) !important; }
.navbar-brand { font-weight: 800; letter-spacing: .2px; }

.btn-primary { background-color: var(--dk-red); border-color: var(--dk-red); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { 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); }
.sidebar-nav .nav-link.active { border-inline-start-color: var(--dk-red); background: rgba(224,61,61,.16); }
.dropdown-item.active, .dropdown-item:active { background-color: var(--dk-red); }
.dropdown-item i { width: 1.1rem; text-align: center; }

/* Digikala-style page headers & forms */
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); }
.form-control, .form-select { border-radius: .5rem; }
.btn { border-radius: .5rem; font-weight: 600; }
.card { box-shadow: 0 1px 4px rgba(0,0,0,.06) !important; }
.table { font-size: .88rem; }
.table thead th { font-weight: 700; color: #4b5563; }

/* ---- grouped submenus (finance-style nav groups, reused where needed) ---- */
.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; }
.badge { border-radius: .45rem; }
.alert { border-radius: .6rem; }

/* ---- 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); }

/* ---- standard sign-in page ---- */
.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 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; }

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

/* product cards (Digikala style) */
.p-card { transition: transform .15s ease, box-shadow .15s ease; overflow: hidden; }
.p-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.14) !important; }
.p-img-wrap { position: relative; display: block; aspect-ratio: 1/1; overflow: hidden; background: #fff; border-bottom: 1px solid #f1f2f4; }
.p-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.p-discount {
  position: absolute; top: 8px; right: 8px; background: var(--dk-red); color: #fff;
  border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
[dir="rtl"] .p-discount { right: auto; left: 8px; }
.p-name { color: #232933; font-size: .88rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.p-price-new { color: var(--dk-red); font-weight: 800; font-size: 1rem; }
.p-price-old { color: #9ca3af; text-decoration: line-through; font-size: .8rem; }
.p-stock-ok { color: #18863b; font-size: .78rem; font-weight: 700; }
.p-stock-no { color: #9ca3af; font-size: .78rem; font-weight: 600; }
.p-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: .5rem; border: 1px solid #dee2e6; }

/* ---- Custom confirmation modal (replaces the browser confirm dialog) ---- */
#cfmModal .modal-content { border: none; border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden; }
.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: linear-gradient(135deg, #ff6b6b, #e63946); color: #fff; font-size: 30px;
  box-shadow: 0 10px 24px rgba(230, 57, 70, .35); animation: cfm-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.cfm-icon::after { content: ''; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(230, 57, 70, .3); animation: cfm-ring 1.6s ease-out infinite; }
@keyframes cfm-pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes cfm-ring { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.cfm-title { font-weight: 800; font-size: 1.05rem; color: #1c2333; }
.cfm-msg { font-size: .9rem; line-height: 1.55; }
.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, #e63946, #d90429); box-shadow: 0 6px 16px rgba(217, 4, 41, .35); }
.cfm-ok:hover { filter: brightness(1.08); }

/* 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"] .leaflet-popup-content,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea { font-family: 'Vazirmatn', 'Segoe UI', 'Helvetica Neue', Arial, Tahoma, sans-serif; }
