/**
 * Refugee Module Complete Stylesheet
 * Path: migration-clients/assets/css/refugee-module.css
 * 
 * ویژگی‌ها و اصلاحات اعمال‌شده:
 * - طراحی مینیمال و استاندارد نوار اسکرول مراحل (بدون اسکرول‌بار زشت مرورگر)
 * - سنتر شدن دقیق آیکون ضربدر دکمه حذف سطر ریپیتر با استفاده از !important
 * - استایل‌های جامع ارور اعتبارسنجی (کادر قرمز، لرزش ملایم و پیام خطا زیر فیلد)
 * - استایل‌های وابستگی شرطی، گرید ساب‌فیلدهای اختصاصی ریپیتر و دکمه‌های کنترلی
 */

.migration-card-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
  text-align: right;
  font-family: inherit;
}

.refugee-module-wrapper {
  width: 100%;
  box-sizing: border-box;
}

/* ================================================================ */
/* === 1. استپر افقی مراحل با اسکرول‌بار مدرن و مینیمال === */
/* ================================================================ */

.refugee-stepper-bar {
  display: flex !important;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  background: #f8fafc !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  border: 1px solid #e2e8f0 !important;
  margin-bottom: 30px !important;
  scroll-behavior: smooth !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  scrollbar-color: #cbd5e1 #f1f5f9 !important;
}

/* استایل اسکرول‌بار مرورگرهای مبتنی بر Webkit */
.refugee-stepper-bar::-webkit-scrollbar {
  height: 5px !important;
}

.refugee-stepper-bar::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-radius: 10px !important;
}

.refugee-stepper-bar::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 10px !important;
  transition: background 0.2s ease !important;
}

.refugee-stepper-bar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

.step-indicator-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 14px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  opacity: 0.75 !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}

.step-indicator-item:hover {
  opacity: 1 !important;
  border-color: #2a9d8f !important;
  transform: translateY(-1px) !important;
}

.step-indicator-item.active {
  opacity: 1 !important;
  border-color: #2a9d8f !important;
  background: #f0fdf4 !important;
  box-shadow: 0 2px 8px rgba(42, 157, 143, 0.15) !important;
}

.step-indicator-item.completed {
  border-color: #86efac !important;
  background: #f0fdf4 !important;
  opacity: 0.9 !important;
}

.step-num {
  width: 22px !important;
  height: 22px !important;
  background: #e2e8f0 !important;
  color: #334155 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
}

.step-indicator-item.active .step-num {
  background: #2a9d8f !important;
  color: #ffffff !important;
}

.step-indicator-item.completed .step-num {
  background: #22c55e !important;
  color: #ffffff !important;
}

.step-name {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  line-height: 1.2 !important;
}

/* ================================================================ */
/* === 2. پنل‌های گام‌های ویزارد و گرید فیلدها === */
/* ================================================================ */

.refugee-wizard-step-pane {
  display: none;
}

.refugee-wizard-step-pane.active-pane {
  display: block;
  animation: refugeeFadeSlideIn 0.35s ease-out forwards;
}

@keyframes refugeeFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.refugee-wizard-step-pane .pane-card-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.refugee-form-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 16px 18px;
  border-radius: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.refugee-form-group.full-width {
  grid-column: span 2;
}

.refugee-form-group:focus-within {
  border-color: #94a3b8;
}

.refugee-form-group label {
  display: block;
  font-weight: 700;
  color: #1e293b;
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.refugee-form-group label .required-star {
  color: #ef4444;
  margin-right: 3px;
}

.ref-input-control {
  width: 100% !important;
  padding: 10px 14px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  font-size: 13.5px !important;
  color: #1e293b !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
  outline: none !important;
  min-height: 44px !important;
}

textarea.ref-input-control {
  min-height: 90px !important;
  resize: vertical !important;
  line-height: 1.6 !important;
}

.ref-input-control:focus {
  border-color: #2a9d8f !important;
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15) !important;
  background: #ffffff !important;
}

.force-ltr {
  direction: ltr !important;
  text-align: left !important;
}

.field-help-text {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.4;
}

/* ورودی‌های رادیویی (Radio / Switch) */
.ref-radio-group {
  display: flex;
  gap: 20px;
  align-items: center;
  min-height: 44px;
}

.ref-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px !important;
  color: #334155;
  margin-bottom: 0 !important;
  user-select: none;
}

.ref-radio-label input[type="radio"] {
  accent-color: #2a9d8f;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ================================================================ */
/* === 3. استایل جامع ارورهای اعتبارسنجی (Validation Errors) === */
/* ================================================================ */

.refugee-form-group.has-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  animation: refugeeShake 0.3s ease-in-out !important;
}

.refugee-form-group.has-error .ref-input-control {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
  background: #ffffff !important;
}

.field-error-message {
  color: #dc2626 !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  margin-top: 6px !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  line-height: 1.4 !important;
  animation: refugeeFadeIn 0.2s ease !important;
}

.field-error-message::before {
  content: "⚠";
  font-size: 13px;
  line-height: 1;
}

@keyframes refugeeShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes refugeeFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================================ */
/* === 4. بخش‌های چندموردی (Repeater Cards) و سنتر ضربدر حذف === */
/* ================================================================ */

.ref-repeater-container {
  grid-column: span 2;
  margin-top: 10px;
}

.ref-repeater-container .repeater-main-label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}

.ref-repeater-card-item {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 15px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  position: relative;
}

.ref-repeater-card-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.card-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12.5px;
  font-weight: 800;
  color: #475569;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

/* رفع مشکل سنتر نبودن ضربدر در دکمه دایره‌ای قرمز */
.btn-remove-repeater-row {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: none !important;
  border-radius: 50% !important;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  cursor: pointer !important;
  font-weight: 900 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  text-align: center !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  vertical-align: middle !important;
}

.btn-remove-repeater-row:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(1.1) !important;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3) !important;
}

.btn-remove-repeater-row:active {
  transform: scale(0.95) !important;
}

.card-item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.card-item-grid.grid-1-col {
  grid-template-columns: 1fr;
}

.card-item-grid.grid-3-col {
  grid-template-columns: repeat(3, 1fr);
}

.card-subfield-group {
  display: flex;
  flex-direction: column;
}

.card-subfield-group label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.card-subfield-group .ref-input-control {
  min-height: 40px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.btn-add-repeater-row {
  background: #264653 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 9px 18px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(38, 70, 83, 0.2) !important;
  margin-top: 5px !important;
}

.btn-add-repeater-row:hover {
  background: #1e3640 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(38, 70, 83, 0.25) !important;
}

/* ================================================================ */
/* === 5. دکمه‌های ناوبری، ذخیره پیش‌نویس و ثبت نهایی === */
/* ================================================================ */

.pane-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 35px;
  border-top: 1px solid #e2e8f0;
  padding-top: 22px;
  grid-column: span 2;
  gap: 15px;
  flex-wrap: wrap;
}

.footer-nav-left,
.footer-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ref-btn {
  padding: 10px 22px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  border: none !important;
  box-sizing: border-box !important;
  min-height: 42px !important;
}

.btn-wizard-next {
  background: #2a9d8f !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(42, 157, 143, 0.25) !important;
}

.btn-wizard-next:hover {
  background: #238579 !important;
  transform: translateY(-1px) !important;
}

.btn-wizard-prev {
  background: #e2e8f0 !important;
  color: #334155 !important;
}

.btn-wizard-prev:hover {
  background: #cbd5e1 !important;
}

.btn-save-draft {
  background: #f8fafc !important;
  color: #264653 !important;
  border: 1px solid #cbd5e1 !important;
}

.btn-save-draft:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

.btn-submit-final {
  background: #16a34a !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
}

.btn-submit-final:hover {
  background: #15803d !important;
  transform: translateY(-1px) !important;
}

.ref-btn:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* اسپینر لودینگ درون دکمه */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: refSpin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes refSpin {
  to { transform: rotate(360deg); }
}

/* مخفی‌سازی وابسته به شرط (Conditional Display) */
.ref-condition-hidden {
  display: none !important;
}

/* ================================================================ */
/* === 6. حالت ریسپانسیو (موبایل و تبلت) === */
/* ================================================================ */

@media (max-width: 992px) {
  .card-item-grid.grid-3-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .migration-card-box {
    padding: 18px 14px;
    border-radius: 12px;
  }

  .refugee-wizard-step-pane .pane-card-body {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .refugee-form-group,
  .refugee-form-group.full-width,
  .ref-repeater-container,
  .pane-card-footer {
    grid-column: span 1 !important;
  }

  .card-item-grid,
  .card-item-grid.grid-3-col {
    grid-template-columns: 1fr !important;
  }

  .pane-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-nav-left,
  .footer-nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .ref-btn {
    flex: 1;
  }
}