/* ═══════════════════════════════════════════════════
   مستحصله - استایل‌های تخصصی
   ═══════════════════════════════════════════════════ */

.mostahsela-tool-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ┌─────────────────────────────────────────────────────┐
   │ ورودی و فیلدهای تکست
   └─────────────────────────────────────────────────────┘ */

.mostahsela-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: 'Amiri', serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 80px;
  resize: vertical;
  direction: rtl;
}

.mostahsela-textarea:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.02);
}

.mostahsela-number-input {
  width: 50px;
  padding: 4px 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 3px;
  background: var(--card-bg);
  color: var(--ink);
  text-align: center;
  font-size: 13px;
}

.mostahsela-number-input:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.5);
}

/* ┌─────────────────────────────────────────────────────┐
   │ انتخاب روش - کارت‌های بزرگ
   └─────────────────────────────────────────────────────┘ */

.mostahsela-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mostahsela-mode-btn {
  padding: 16px 12px;
  border: 2px solid rgba(201, 168, 76, 0.2);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--ink);
  font-family: 'Amiri', serif;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mostahsela-mode-btn .mode-name {
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.mostahsela-mode-btn .mode-label {
  font-size: 12px;
  color: var(--ink-dim);
  display: block;
  line-height: 1.4;
}

.mostahsela-mode-btn:hover {
  border-color: rgba(201, 168, 76, 0.4);
  background: rgba(201, 168, 76, 0.04);
}

.mostahsela-mode-btn.active {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold);
}

.mostahsela-mode-btn.active .mode-name {
  color: var(--gold);
}

/* ┌─────────────────────────────────────────────────────┐
   │ آزمون‌ها - کارت‌های سه‌تایی
   └─────────────────────────────────────────────────────┘ */

.mostahsela-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.mostahsela-test-item {
  padding: 12px;
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 4px;
  background: rgba(201, 168, 76, 0.02);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-checkbox {
  display: none;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(201, 168, 76, 0.2);
  border-radius: 12px;
  transition: background 0.3s ease;
  cursor: pointer;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--card-bg);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.3s ease;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

.toggle-checkbox:checked + .toggle-slider {
  background: rgba(201, 168, 76, 0.4);
}

.toggle-checkbox:checked + .toggle-slider::after {
  left: calc(100% - 22px);
  background: var(--gold);
  border-color: var(--gold);
}

/* ┌─────────────────────────────────────────────────────┐
   │ دکمه اجرا
   └─────────────────────────────────────────────────────┘ */

.mostahsela-run-btn {
  width: 100%;
  margin: 24px 0;
  padding: 14px;
  font-size: 16px;
}

/* ┌─────────────────────────────────────────────────────┐
   │ نتایج و خروجی نهایی
   └─────────────────────────────────────────────────────┘ */

.mostahsela-result-card {
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.04), rgba(0, 0, 0, 0.2));
}

.mostahsela-final-row {
  font-family: 'Amiri', serif;
  font-size: 32px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 3px;
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  margin-bottom: 16px;
  word-break: break-word;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mostahsela-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mostahsela-summary-chip {
  padding: 12px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 4px;
  background: rgba(201, 168, 76, 0.05);
  text-align: center;
}

.chip-label {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.chip-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
}

/* ┌─────────────────────────────────────────────────────┐
   │ مراحل - Accordion
   └─────────────────────────────────────────────────────┘ */

.mostahsela-steps-list {
  max-height: 600px;
  overflow-y: auto;
}

.mostahsela-step-entry {
  margin-bottom: 8px;
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 4px;
  background: var(--card-bg);
  overflow: hidden;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.06), transparent);
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.step-header:hover {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.1), transparent);
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: rgba(201, 168, 76, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--gold);
  font-size: 12px;
}

.step-original {
  font-family: 'Amiri', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.step-final {
  font-family: 'Amiri', serif;
  font-size: 16px;
  font-weight: 600;
}

.step-final.unchanged {
  color: var(--ink);
}

.step-final.accepted {
  color: #6abc6a;
}

.step-final.rejected {
  color: #c17070;
}

.step-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
}

.step-badge.accepted {
  background: rgba(106, 188, 106, 0.2);
  color: #6abc6a;
}

.step-badge.changed {
  background: rgba(100, 149, 237, 0.2);
  color: #6495ed;
}

.step-badge.deleted {
  background: rgba(193, 112, 112, 0.2);
  color: #c17070;
}

.step-badge.queued {
  background: rgba(201, 168, 76, 0.2);
  color: var(--gold);
}

.step-chevron {
  flex-shrink: 0;
  color: var(--gold-dim);
  transition: transform 0.2s ease;
}

.mostahsela-step-entry.open .step-chevron {
  transform: rotate(-90deg);
}

.step-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
  background: rgba(0, 0, 0, 0.2);
}

.mostahsela-step-entry.open .step-body {
  max-height: 1000px;
  overflow: auto;
}

.step-detail {
  padding: 12px;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.6;
}

.step-detail.fail {
  color: #c17070;
}

.step-detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  font-size: 13px;
}

.step-detail-row:last-child {
  border-bottom: none;
}

.step-detail-row .label {
  font-weight: 600;
  color: var(--gold-dim);
  display: block;
}

.step-detail-row .value {
  color: var(--ink-dim);
  word-break: break-word;
  font-family: 'Amiri', serif;
}

.step-detail-row .value.pass {
  color: #6abc6a;
}

.step-detail-row .value.fail {
  color: #c17070;
}

.step-detail-row .path {
  font-family: 'Amiri', serif;
  letter-spacing: 1px;
  color: var(--ink);
}

.mostahsela-queue-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 4px;
  background: rgba(201, 168, 76, 0.05);
}

/* ┌─────────────────────────────────────────────────────┐
   │ اقدامات
   └─────────────────────────────────────────────────────┘ */

.mostahsela-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.mostahsela-actions .tool-btn {
  width: 100%;
}

/* ┌─────────────────────────────────────────────────────┐
   │ واکنش برای موبایل
   └─────────────────────────────────────────────────────┘ */

@media (max-width: 600px) {
  .mostahsela-mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mostahsela-test-grid {
    grid-template-columns: 1fr;
  }

  .mostahsela-summary-row {
    grid-template-columns: 1fr;
  }

  .mostahsela-actions {
    grid-template-columns: 1fr;
  }

  .mostahsela-final-row {
    font-size: 24px;
    letter-spacing: 2px;
  }
}
