/* ===========================================================
   سیستم مدیریت اقساط - استایل اصلی
   پالت رنگ: سرمه‌ای تیره برای ساید‌بار / سبز زمردی برای موفقیت
   نارنجی کهربایی برای هشدار و معوقات / قرمز برای خطر و حذف
   =========================================================== */

:root {
    --c-navy: #1b2540;
    --c-navy-light: #243154;
    --c-navy-lighter: #2d3b63;
    --c-accent: #3460d8;
    --c-accent-light: #5b82ea;
    --c-success: #16a673;
    --c-success-bg: #e6f7f0;
    --c-warning: #e08a1e;
    --c-warning-bg: #fdf1e0;
    --c-danger: #d9434e;
    --c-danger-bg: #fbe9ea;
    --c-info: #2a8fbd;
    --c-info-bg: #e7f4fa;
    --c-bg: #f3f5f9;
    --c-card: #ffffff;
    --c-text: #1f2937;
    --c-text-soft: #6b7280;
    --c-border: #e6e9f0;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(20, 30, 60, 0.06);
    --shadow-md: 0 6px 18px rgba(20, 30, 60, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14.5px;
}

a { text-decoration: none; }

/* ---------- لایه‌بندی اصلی ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--c-navy) 0%, #141c33 100%);
    color: #d7deee;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .logo-badge {
    width: 38px; height: 38px;
    background: var(--c-accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 16px;
}
.sidebar-brand .brand-text { font-weight: 700; font-size: 15px; color: #fff; }
.sidebar-brand .brand-sub { font-size: 11px; color: #9aa6c4; }

.sidebar-nav { padding: 14px 12px; list-style: none; margin: 0; }
.sidebar-nav .nav-group-title {
    font-size: 11px; color: #768097; padding: 14px 12px 6px; letter-spacing: .5px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    color: #c4cbe0; padding: 10px 14px; border-radius: 9px;
    font-size: 13.5px; margin-bottom: 3px; transition: all .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--c-accent); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-nav a .ic { font-size: 16px; width: 20px; text-align: center; }

.main-area { flex: 1; margin-right: 250px; min-width: 0; }

.topbar {
    background: var(--c-card);
    border-bottom: 1px solid var(--c-border);
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 980;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .page-desc { font-size: 12.5px; color: var(--c-text-soft); margin-top: 2px; }
.topbar .admin-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--c-bg); padding: 6px 14px; border-radius: 30px; font-size: 13px;
}
.menu-toggle { display: none; }

.content { padding: 24px; }

/* ---------- کارت‌ها ---------- */
.card-box {
    background: var(--c-card);
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}
.card-box .card-box-title {
    font-size: 14.5px; font-weight: 700; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
}

/* ---------- کارت‌های آماری داشبورد ---------- */
.stat-card {
    background: var(--c-card);
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 14px;
    height: 100%;
}
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 19px; font-weight: 800; line-height: 1.3; }
.stat-card .stat-label { font-size: 12px; color: var(--c-text-soft); }
.icon-blue   { background: #e8edfc; color: var(--c-accent); }
.icon-green  { background: var(--c-success-bg); color: var(--c-success); }
.icon-orange { background: var(--c-warning-bg); color: var(--c-warning); }
.icon-red    { background: var(--c-danger-bg); color: var(--c-danger); }
.icon-info   { background: var(--c-info-bg); color: var(--c-info); }

/* ---------- جدول‌ها ---------- */
.table { font-size: 13.5px; }
.table thead th {
    background: #f7f8fb; color: var(--c-text-soft); font-weight: 700;
    font-size: 12px; border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
.table td { vertical-align: middle; white-space: nowrap; }
.table-hover tbody tr:hover { background: #f7f9fd; }

/* ---------- بج وضعیت ---------- */
.badge-status { font-size: 11.5px; padding: 5px 10px; border-radius: 30px; font-weight: 600; }
.badge-pending   { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-partial   { background: var(--c-info-bg); color: var(--c-info); }
.badge-paid      { background: var(--c-success-bg); color: var(--c-success); }
.badge-suspended { background: #ececec; color: #777; }
.badge-overdue   { background: var(--c-danger-bg); color: var(--c-danger); }

/* ---------- دکمه‌ها ---------- */
.btn { border-radius: 9px; font-size: 13.5px; }
.btn-primary { background: var(--c-accent); border-color: var(--c-accent); }
.btn-primary:hover { background: #2a4fbd; border-color: #2a4fbd; }
.btn-success { background: var(--c-success); border-color: var(--c-success); }
.btn-soft-primary { background: #e8edfc; color: var(--c-accent); border: none; }
.btn-soft-success { background: var(--c-success-bg); color: var(--c-success); border: none; }
.btn-soft-danger { background: var(--c-danger-bg); color: var(--c-danger); border: none; }
.btn-soft-warning { background: var(--c-warning-bg); color: var(--c-warning); border: none; }
.btn-soft-info { background: var(--c-info-bg); color: var(--c-info); border: none; }
.btn-sm-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- فرم‌ها ---------- */
.form-label { font-size: 13px; font-weight: 600; color: #3a4257; margin-bottom: 6px; }
.form-control, .form-select {
    border-radius: 9px; border: 1px solid #dfe3ec; font-size: 13.5px; padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--c-accent-light); box-shadow: 0 0 0 3px rgba(52,96,216,.12);
}
.input-group-text { background: #f7f8fb; border-color: #dfe3ec; font-size: 13px; }
.required-star { color: var(--c-danger); }

.jalali-date-group { display: flex; gap: 6px; }
.jalali-date-group select { font-size: 13px; }

/* ---------- اتوکامپلیت مشتری ---------- */
.cust-suggest-box {
    position: absolute; z-index: 50; background: #fff; border: 1px solid var(--c-border);
    border-radius: 10px; box-shadow: var(--shadow-md); width: 100%; max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.cust-suggest-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f2f6; font-size: 13px; }
.cust-suggest-item:last-child { border-bottom: none; }
.cust-suggest-item:hover { background: #f3f6fd; }
.cust-suggest-item .cs-name { font-weight: 700; }
.cust-suggest-item .cs-mobile { color: var(--c-text-soft); font-size: 12px; }

/* ---------- لاگین ---------- */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--c-navy) 0%, #2a3a66 100%);
}
.login-box {
    background: #fff; border-radius: 18px; padding: 38px 34px; width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-box .logo-badge {
    width: 56px; height: 56px; background: var(--c-accent); border-radius: 14px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px;
    margin: 0 auto 16px;
}


/*----------- باز و بسته شدن ساید بار - - - - - - - - */
.sidebar-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    visibility: hidden;
    transition: .25s;
    z-index: 999;
}

.sidebar-backdrop.show{
    opacity: 1;
    visibility: visible;
}

#appSidebar{
    z-index: 1000;
}

body.sidebar-open{
    overflow: hidden;
}

@media (min-width:376px){
    .sidebar-backdrop{
        display:none;
    }
}

/* ---------- ریسپانسیو ---------- */
@media (max-width: 376px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: translateX(0); }
    .main-area { margin-right: 0; }
    .menu-toggle { display: inline-flex; }
}

.empty-state { text-align: center; padding: 50px 20px; color: var(--c-text-soft); }
.empty-state .ic { font-size: 42px; margin-bottom: 12px; opacity: .5; }

.text-money { font-weight: 700; font-family: 'Vazirmatn', Tahoma, sans-serif; }
.muted-sm { font-size: 12px; color: var(--c-text-soft); }

.fade-row-paid { opacity: .55; }

.nav-tabs .nav-link.active { font-weight: 700; }

.progress { height: 7px; border-radius: 10px; background: #eef0f5; }
.progress-bar { background: var(--c-success); }
