/* ========================================
   assets/style.css – نسخه با فونت Vazirmatn محلی
   ======================================== */

/* ---------- تعریف فونت وزیرمتن از فایل‌های محلی ---------- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/* ---------- متغیرهای رنگ ---------- */
:root {
  --green-light: #e7f3e8;
  --green-mid: #239f40;
  --green-dark: #1b7a32;
  --red: #da0000;
  --white: #ffffff;
  --bg: #f5f5f5;
  --text: #2f3640;
  --shadow: 0 0 20px rgba(0,0,0,0.05);
  --border-color: #e1e4e8;
  --warning-bg: #fff3cd;
  --warning-border: #ffeeba;
  --info-bg: #e8f5e9;
}

/* ---------- ریست کلی ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Vazirmatn', 'Vazir', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  height: 100vh;
  display: flex;
}

/* ---------- یکسان‌سازی فونت اعداد در ورودی‌ها ---------- */
input.form-control,
.form-control input,
.modal-content input,
.modal-content select,
.modal-content textarea,
.jdp {
  font-family: 'Vazirmatn', 'Courier New', monospace;
  font-feature-settings: "ss02";
  letter-spacing: 0;
}

/* ---------- صفحهٔ ورود ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: linear-gradient(135deg, var(--green-light) 0%, #ffffff 100%);
}

.login-box {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-box h2 {
  color: var(--green-dark);
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.login-box input {
  width: 100%;
  padding: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.login-box button {
  width: 100%;
  padding: 0.9rem;
  background: var(--green-mid);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box button:hover {
  background: var(--green-dark);
  color: white;
}

/* ---------- ساختار اصلی بعد از ورود ---------- */
.app-layout {
  display: flex;
  width: 100%;
}

/* ---------- سایدبار ---------- */
.sidebar {
  width: 240px;
  background: var(--white);
  border-left: 3px solid var(--green-dark);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  height: 100vh;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header i {
  font-size: 1.8rem;
  color: var(--green-dark);
}

.sidebar-header span {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text);
}

#profileNameLink {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    background-color: rgba(35, 159, 64, 0.05);
    text-decoration: none !important;
}

#profileNameLink:hover {
    font-weight: bold;
    background-color: rgba(35, 159, 64, 0.15);
    transform: scale(1.02);
    color: #1b7a32;
    text-decoration: none !important;
}

.menu-items {
  flex: 1;
  padding: 1rem 0;
}

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0.8rem 1.5rem;
  margin: 0.2rem 0.8rem;
  border-radius: 8px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.menu-item i {
  width: 20px;
  color: var(--green-dark);
}

.menu-item:hover {
  background: var(--green-light);
}

.menu-item.active {
  background: var(--green-mid);
  color: var(--text);
  font-weight: bold;
}

.logout-btn {
  margin: 1rem;
  padding: 0.7rem;
  background: #fff0f0;
  color: var(--red);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ---------- محتوای اصلی ---------- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- کارت‌های خلاصه (داشبورد) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: white;
  padding: 1.2rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  border-right: 4px solid var(--green-mid);
}

.card-label {
  font-size: 0.9rem;
  color: #777;
}

.card-value {
  font-size: 1.5rem;
  font-weight: bold;
}

/* ---------- جدول‌ها ---------- */
.table-container {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table th {
  background: var(--green-mid);
  color: var(--text);
  padding: 1rem;
  text-align: center;
  font-weight: 600;
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  vertical-align: middle;
}

.data-table td.amount,
.table-container td.amount {
  text-align: center;
  direction: ltr;
  font-family: 'Vazirmatn', 'Courier New', monospace;
}

.data-table td.actions {
  text-align: center;
}

/* ---------- دکمه‌ها ---------- */
.btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--green-mid);
  color: var(--text);
}

.btn-primary:hover {
  background: var(--green-dark);
  color: white;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-outline {
  background: white;
  border: 1px solid #ccc;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  margin: 0 4px;
  transition: transform 0.1s;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-block {
  width: 100%;
  padding: 12px;
}

/* ---------- مودال ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}

/* ---------- فرم‌ها ---------- */
.form-section {
  margin-top: 1.5rem;
}

.form-section h4 {
  color: var(--green-dark);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
  font-size: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-help {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ---------- استایل‌های مخصوص مودال تأیید/ویرایش وام ---------- */
.loan-approval-modal .financial-summary-card {
  background: var(--info-bg);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-right: 4px solid var(--green-mid);
}

.loan-approval-modal .financial-summary-card.has-overdue {
  border-right-color: var(--red);
  background: var(--warning-bg);
}

.loan-approval-modal .summary-title {
  font-weight: bold;
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.loan-approval-modal .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.loan-approval-modal .summary-warning {
  margin-top: 0.8rem;
  padding: 0.5rem;
  background: var(--warning-bg);
  border-radius: 6px;
  color: #856404;
  font-size: 0.85rem;
}

/* ---------- جدول شبیه‌ساز اقساط ---------- */
.simulator-table {
  width: 100%;
  font-size: 0.85rem;
}

.simulator-table th,
.simulator-table td {
  padding: 0.5rem;
  text-align: center;
}

.simulator-total-row {
  background: #f8f9fa;
  font-weight: bold;
}

.simulator-total-valid {
  color: var(--green-dark);
}

.simulator-total-invalid {
  color: var(--red);
}

.simulator-error {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #856404;
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

/* ---------- پیش‌نمایش اقساط در فرم ---------- */
.preview-row .form-group input {
  background: #f8f9fa;
  font-weight: bold;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #2f3640;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 10000;
  font-family: 'Vazirmatn', 'Vazir', Tahoma, sans-serif;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 350px;
  word-wrap: break-word;
}

.toast.toast-info { background: #2f3640; }
.toast.toast-error { background: var(--red); }
.toast.toast-success { background: var(--green-mid); }

/* ===== استایل آیکون زنگوله و Badge ===== */
.notif-bell-container {
    position: relative;
    margin: 10px 0 5px;
    cursor: pointer;
    text-align: center;
}

.notif-bell {
    font-size: 1.8rem;
    color: var(--green-mid);
    transition: transform 0.2s ease;
    display: inline-block;
}

.notif-bell:hover {
    transform: scale(1.1);
}

.notif-badge {
    position: absolute;
    top: -8px;
    right: calc(50% - 18px);
    background: var(--red);
    color: white;
    border-radius: 30px;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    direction: ltr;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ---------- Badge تأییدها ---------- */
.wi-badge {
  display: none;
  background: var(--red);
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  margin-right: auto;
}

/* ---------- لودینگ اسپینر ---------- */
.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

.loading-spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- حالت خالی و خطا ---------- */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: #64748b;
}

.error-text {
  color: #dc2626;
  text-align: center;
}

/* ===== زنگوله در کنار منوی اعلان‌ها (برای کاربر عادی) ===== */
.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-bell-wrapper {
  position: relative;
  margin-right: auto;
  cursor: pointer;
}
.menu-item .notif-bell {
  font-size: 1.2rem;
  color: var(--green-mid);
}
.menu-item .notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: white;
  border-radius: 30px;
  min-width: 16px;
  height: 16px;
  font-size: 0.6rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  direction: ltr;
}
.menu-item {
  text-align: right;
  justify-content: flex-start;
}
.notif-bell-wrapper {
  margin-right: auto;
  margin-left: 0;
}

/* ---------- ردیف معوق در جداول ---------- */
.overdue-row {
  background: #fff0f0 !important;
}

.pending-row {
  background: #fff8e0 !important;
}

/* ---------- استایل‌های مخصوص مدیریت اعلان‌ها ---------- */
.notifications-dashboard .modern-table {
    width: 100%;
    border-collapse: collapse;
}

.notifications-dashboard .modern-table th,
.notifications-dashboard .modern-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.notifications-dashboard .modern-table th {
    background-color: var(--green-mid);
    color: white;
    font-weight: bold;
}

.notifications-dashboard .modern-table td.date {
    direction: ltr;
    font-family: 'Vazirmatn', monospace;
    font-size: 0.95rem;
}

.notifications-dashboard .actions {
    white-space: nowrap;
}

.notifications-dashboard .btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 0 4px;
    transition: transform 0.1s;
}

.notifications-dashboard .btn-icon:hover {
    transform: scale(1.1);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.page-btn.active {
    background: var(--green-mid);
    color: white;
    border-color: var(--green-mid);
}

/* ---------- رسپانسیو (موبایل) ---------- */
@media (max-width: 768px) {
  .sidebar {
    display: none;
    position: fixed;
    height: 100%;
    z-index: 10;
  }
  .sidebar.open {
    display: flex;
    width: 260px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .modal-content {
    width: 95%;
    padding: 1rem;
  }
  .data-table {
    font-size: 0.8rem;
  }
  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }
}

/* ===== استایل پرکنندهٔ SPA ===== */
#app {
    width: 100%;
    min-height: 100vh;
}

/* اگر فقط صفحه لاگین نمایش داده شود */
#app > .login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--green-light) 0%, #ffffff 100%);
}

/* =====================================================
   استایل‌های شبیه‌سازی طرح واریز گروهی
   ===================================================== */

.simulation-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid #e9ecef;
}

.simulation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.summary-card {
    background: white;
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
    border-right: 3px solid #239f40;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.summary-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: #239f40;
}

.simulation-members {
    margin-top: 0.5rem;
}

.simulation-members h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #2f3640;
    font-weight: 600;
}

.members-list {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
}

.member-sim-card {
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.2s ease;
}

.member-sim-card:hover {
    background: #f1f3f4;
}

.member-sim-card:last-child {
    border-bottom: none;
}

.member-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    font-size: 0.85rem;
}

.member-name {
    font-weight: bold;
    min-width: 120px;
    color: #2c3e50;
}

.member-group {
    color: #239f40;
    font-size: 0.75rem;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 20px;
}

.member-shares {
    color: #6c757d;
    font-size: 0.75rem;
}

.member-total {
    font-weight: bold;
    color: #2c3e50;
    margin-right: auto;
    font-family: 'Vazirmatn', 'Courier New', monospace;
}

.member-installments {
    padding: 0.8rem;
    background: #f8f9fa;
    border-top: 1px dashed #dee2e6;
}

.simulation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.simulation-table th {
    background: #e9ecef;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    color: #495057;
}

.simulation-table td {
    padding: 0.4rem;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.simulation-table td.amount {
    direction: ltr;
    font-family: 'Vazirmatn', 'Courier New', monospace;
}

.simulation-table tr:last-child td {
    border-bottom: none;
}

/* ---------- استایل‌های مربوط به فیلدهای جدید در جدول طرح‌ها ---------- */
.data-table td.month-range,
.data-table td.amount {
    direction: ltr;
    font-family: 'Vazirmatn', 'Courier New', monospace;
    text-align: center;
}

/* ---------- استایل فیلدهای فرم با برچسب checkbox در یک خط ---------- */
.form-group-checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    min-height: 38px;
}

/* ---------- استایل پنل انتخاب اعضا ---------- */
.members-checklist-scroll {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.8rem;
    background: #f9f9f9;
}

/* ---------- استایل نمایش خطا در شبیه‌سازی ---------- */
.simulation-error {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    text-align: center;
}

/* ---------- استایل ردیف جمع در جدول طرح‌ها ---------- */
.total-row td.amount {
    font-weight: bold;
    color: #239f40;
}