/* ==========================================================================
   Safaan Assessment System - Modern Persian Mobile-First Design System
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --accent: #0f766e;
  --accent-light: #ccfbf1;
  --bg-main: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.94);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: rgba(226, 232, 240, 0.8);
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --info: #0ea5e9;
  --info-bg: #f0f9ff;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --orange: #f97316;
  --orange-bg: #fff7ed;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.08), 0 6px 12px -4px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Tahoma", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  direction: rtl;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 12%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 18%, rgba(16, 185, 129, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(245, 158, 11, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(15, 118, 110, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* Container */
.container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

.container-wide {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

/* Header & Nav */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  box-sizing: border-box;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 66px;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #0284c7, #0f766e);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  color: #0f172a;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: #115e59;
}

.btn-outline {
  background: white;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 16px;
  border-radius: var(--radius);
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  max-width: 100%;
  box-sizing: border-box;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hero / Welcome */
.hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-radius: var(--radius);
  padding: 40px 32px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -40px;
  left: -40px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.4;
}

.hero-text {
  font-size: 15px;
  color: #cbd5e1;
  max-width: 780px;
  line-height: 1.8;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Notice Box */
.notice-box {
  background: #f8fafc;
  border-right: 4px solid var(--primary);
  padding: 14px 18px;
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
  font-size: 13.5px;
  color: #334155;
  margin-bottom: 24px;
  line-height: 1.7;
}

.notice-box.warning {
  background: #fffbeb;
  border-right-color: #f59e0b;
  color: #92400e;
}

/* Progress bar */
.progress-container {
  background: #e2e8f0;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-bar {
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Survey Component Card */
.comp-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.comp-header-badge.section2 {
  background: #fef3c7;
  color: #b45309;
}

/* Scale Guide */
.scale-guide {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.scale-guide span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Question Item Card - Mobile First */
.question-item {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.question-item:last-child {
  margin-bottom: 0;
}

.question-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.question-item.answered {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.question-badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 14px;
  transition: all 0.25s ease;
}

.question-item.answered .question-badge-num {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.question-text {
  font-size: 15.5px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.7;
  flex: 1;
}

/* Likert 5 Options Scale - Mobile Optimized */
.likert-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.likert-option {
  position: relative;
  cursor: pointer;
}

.likert-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.likert-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 8px 4px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.likert-label .val-num {
  font-size: 18px;
  font-weight: 800;
  color: #475569;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.likert-label .val-text {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.25;
}

/* Emotionally Neutral & Non-Judgmental Selection - Eliminates Social Desirability Bias */
.likert-option input[type="radio"]:checked + .likert-label {
  background: #f0fdfa;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.22);
  transform: translateY(-2px);
}

.likert-option input[type="radio"]:checked + .likert-label .val-num {
  color: #0f766e;
  font-weight: 900;
  transform: scale(1.1);
}

.likert-option input[type="radio"]:checked + .likert-label .val-text {
  color: #0f766e;
  font-weight: 800;
}

.likert-label:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.likert-label:active {
  transform: scale(0.96);
}

@media (max-width: 640px) {
  .likert-scale {
    gap: 6px;
  }
  .likert-label {
    min-height: 66px;
    padding: 8px 2px;
    border-radius: 10px;
  }
  .likert-label .val-num {
    font-size: 18.5px;
    margin-bottom: 2px;
  }
  .likert-label .val-text {
    font-size: 10px;
    line-height: 1.25;
  }
}

/* Dynamic Choice Hint */
.question-choice-hint {
  margin-top: 10px;
  font-size: 12.5px;
  min-height: 22px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.choice-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 3px 10px;
  border-radius: 8px;
  animation: fadeInHint 0.25s ease-out;
}

.choice-empty {
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 500;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-info {
  background: var(--info-bg);
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-warning {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-orange {
  background: var(--orange-bg);
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.badge-danger {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Priority Card */
.priority-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.priority-card {
  background: white;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.priority-rank {
  position: absolute;
  top: -12px;
  right: 18px;
  background: #ea580c;
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
}

.priority-title {
  font-size: 15px;
  font-weight: 700;
  color: #9a3412;
  margin-top: 6px;
  margin-bottom: 8px;
}

.priority-gap {
  font-size: 13px;
  color: #475569;
}

.priority-counseling-box {
  margin-top: 14px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 12px 14px;
}

.priority-counseling-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #065f46;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.priority-counseling-text {
  font-size: 13px;
  color: #0f172a;
  line-height: 1.7;
}

/* Radar & Charts */
.chart-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Table */
.data-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13.5px;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: #f8fafc;
}

/* Admin Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 11px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Stat KPI Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.stat-card.critical {
  border-top: 4px solid var(--danger);
  background: #fffafa;
}

.stat-card.thriving {
  border-top: 4px solid var(--success);
  background: #f6fef9;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin: 6px 0 2px 0;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Grid Utilities for Responsive Layout */
.admin-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.analytics-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Wizard Components */
.wizard-progress-card {
  margin-bottom: 16px;
  padding: 16px 20px;
}

.wizard-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.wizard-step-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wizard-step-text {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.wizard-answered-text {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.scale-guide {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.scale-guide span {
  white-space: nowrap;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  gap: 12px;
}

/* Results View Components */
.results-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
}

.results-top-actions-buttons {
  display: flex;
  gap: 10px;
}

.report-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.report-header-user-meta {
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
}

.results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.results-kpi-box {
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  box-sizing: border-box;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

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

.modal-content-wide {
  max-width: 980px !important;
  width: 95% !important;
}

/* Print styling */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .no-print {
    display: none !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* When printing from respondent dossier modal in admin */
  body.has-open-modal header,
  body.has-open-modal .header,
  body.has-open-modal .tabs,
  body.has-open-modal .admin-section,
  body.has-open-modal #adminLoginCard,
  body.has-open-modal #adminMainView,
  body.has-open-modal .modal-header,
  body.has-open-modal .no-print,
  body.printing-modal header,
  body.printing-modal .header,
  body.printing-modal .tabs,
  body.printing-modal .admin-section,
  body.printing-modal #adminLoginCard,
  body.printing-modal #adminMainView,
  body.printing-modal .modal-header,
  body.printing-modal .no-print {
    display: none !important;
  }
  body.has-open-modal .modal-overlay,
  body.printing-modal .modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
    inset: auto !important;
  }
  body.has-open-modal .modal-content,
  body.printing-modal .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* ==========================================================================
   Mobile & Tablet Responsive System (No Overflow, No Two-Line Text Wrap)
   ========================================================================== */

@media (max-width: 768px) {
  /* Prevent iOS auto-zoom on form inputs */
  .form-input, input, select, textarea {
    font-size: 16px !important;
  }

  .container, .container-wide {
    padding: 14px 12px;
  }

  .card {
    padding: 16px 14px;
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .card-header {
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .card-title {
    font-size: 16px;
  }

  /* Header compacting */
  .header-content {
    min-height: 56px;
    padding: 6px 0;
    gap: 8px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-radius: 10px;
  }

  .brand-title {
    font-size: 15.5px;
    white-space: nowrap;
  }

  .brand-subtitle {
    font-size: 11px;
    white-space: nowrap;
  }

  .nav-actions {
    gap: 6px;
  }

  .nav-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Hero Card */
  .hero-card {
    padding: 22px 16px;
    margin-bottom: 18px;
    border-radius: 12px;
  }

  .hero-title {
    font-size: 18.5px;
    line-height: 1.5;
    margin-bottom: 8px;
  }

  .hero-text {
    font-size: 13.5px;
    line-height: 1.7;
  }

  /* Grids */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 12px;
    white-space: nowrap;
  }

  .priority-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-split-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
  }

  .analytics-matrix-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  /* Likert Options: Touch-friendly vertical cards on phone screens */
  /* Ensures "تقریباً هیچ‌وقت" and all options stay on ONE LINE and never wrap into 2 lines! */
  .likert-scale {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .likert-label {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 14px;
    gap: 12px;
    text-align: right;
    min-height: 48px;
    border-radius: 10px;
  }

  .likert-label .val-num {
    width: 28px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5px;
    font-weight: 800;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .likert-label .val-text {
    font-size: 13.5px;
    white-space: nowrap;
  }

  .likert-option input[type="radio"]:checked + .likert-label .val-num {
    background: #10b981;
    color: white;
  }

  /* Wizard Progress header */
  .wizard-progress-card {
    padding: 12px 14px;
  }

  .wizard-progress-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wizard-answered-text {
    align-self: flex-end;
    font-size: 12px;
  }

  /* Scale guide 2-column grid so labels never break into two lines */
  .scale-guide {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 10px;
    padding: 10px 12px;
    font-size: 11.5px;
  }

  .scale-guide span:last-child {
    grid-column: span 2;
    text-align: center;
  }

  /* Wizard sticky bottom thumb-zone bar on mobile */
  #viewSurvey {
    padding-bottom: 85px;
  }

  .wizard-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 10px 16px;
    border-top: 1.5px solid var(--border);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
    z-index: 99;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 0;
  }

  .wizard-actions .btn {
    flex: 1;
    min-height: 48px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: 12px;
  }

  #nextStepBtn {
    flex: 2;
  }

  #prevStepBtn {
    flex: 1;
  }

  #stepValidationMsg:empty {
    display: none !important;
  }

  #stepValidationMsg:not(:empty) {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 8px 12px;
    text-align: center;
    color: var(--danger);
    font-weight: 700;
    font-size: 12.5px;
    margin-top: 10px;
  }

  /* Results Top Actions */
  .results-top-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .results-top-actions h2 {
    font-size: 18px !important;
    text-align: center;
  }

  .results-top-actions-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .results-top-actions-buttons .btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
  }

  /* Results Header user info */
  .report-header-info {
    flex-direction: column;
    gap: 12px;
  }

  .report-header-user-meta {
    text-align: right;
    font-size: 12.5px;
  }

  /* Results KPI Cards: single column horizontal rows to prevent two-line breaks */
  .results-kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
  }

  .results-kpi-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px !important;
    text-align: right !important;
  }

  .results-kpi-box .kpi-num {
    font-size: 26px !important;
    margin: 0 !important;
    flex-shrink: 0;
  }

  /* Hide secondary table columns on mobile to minimize horizontal scroll */
  .hide-mobile {
    display: none !important;
  }

  .data-table th, .data-table td {
    padding: 9px 8px;
    font-size: 12px;
  }

  /* Modal on mobile */
  .modal-overlay {
    padding: 8px;
  }

  .modal-content {
    padding: 16px 12px;
    max-height: 94vh;
    border-radius: 12px;
  }

  .modal-header h3 {
    font-size: 15px !important;
  }

  .modal-kpi-grid, .modal-priorities-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  /* On very small screens, hide long subtitle in header so it stays on 1 clean row */
  .brand-subtitle {
    display: none;
  }

  .container, .container-wide {
    padding: 10px 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .btn-lg {
    padding: 11px 18px;
    font-size: 14.5px;
  }
}

/* ==========================================================================
   Advanced Demographic Filter & Category Analysis Styles
   ========================================================================== */

.filter-panel {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.category-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.category-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
}

.category-card:hover {
  box-shadow: var(--shadow);
}

.category-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.category-card-title {
  font-size: 15.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.category-stat-row.highlight-max {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.category-stat-row.highlight-min {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.category-stat-row.highlight-pop {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.category-stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.category-stat-val {
  font-weight: 800;
  font-size: 14px;
}

/* ==========================================================================
   Counseling Completion View & Settings Styles
   ========================================================================== */

.completion-hero-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0fdfa 100%);
  border: 1.5px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.08);
  position: relative;
}

.completion-hero-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.completion-hero-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.28);
  flex-shrink: 0;
}

.completion-hero-title {
  font-size: 24px;
  font-weight: 900;
  color: #065f46;
  margin-bottom: 6px;
  line-height: 1.35;
}

.completion-hero-subtitle {
  font-size: 14.5px;
  color: #047857;
  line-height: 1.75;
}

.completion-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  background: white;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-top: 18px;
}

.completion-meta-item {
  font-size: 13px;
  color: #334155;
}

.completion-meta-item strong {
  color: #0f172a;
}

.counseling-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.counseling-rule-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.counseling-rule-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.counseling-rule-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: var(--primary);
}

.counseling-rule-card.accent-purple::before {
  background: #8b5cf6;
}

.counseling-rule-card.accent-amber::before {
  background: #f59e0b;
}

.counseling-rule-card.accent-teal::before {
  background: #14b8a6;
}

.counseling-rule-card.accent-emerald::before {
  background: #10b981;
}

.counseling-rule-card.accent-indigo::before {
  background: #6366f1;
}

.counseling-rule-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.counseling-rule-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.counseling-rule-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #0f172a;
}

.counseling-rule-desc {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.8;
  margin: 0;
}

.completion-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.completion-step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.completion-step-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.setting-option-label:hover {
  border-color: var(--primary) !important;
  background: #f8fafc !important;
}

.setting-option-label.active {
  border-color: var(--primary) !important;
  background: #f0fdf4 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Custom report sections checkboxes in admin settings */
.custom-sec-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-sec-checkbox-label:hover {
  border-color: #0284c7;
  background: #f8fafc;
}

.custom-sec-checkbox-label.checked {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.custom-sec-chk {
  margin-top: 4px;
  transform: scale(1.25);
  cursor: pointer;
  accent-color: #0284c7;
}

.custom-sec-info {
  flex: 1;
}

.custom-sec-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #0f172a;
}

.custom-sec-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.6;
}

/* Propositional Narrative Card Styles (توصیف گزاره‌ای و تحلیل روان‌شناختی) */
.narrative-card {
  border-top: 5px solid #0d9488 !important;
  background: #ffffff;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.narrative-hero-badge-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.narrative-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.narrative-tier-established {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.narrative-tier-appropriate {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.narrative-tier-attention {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.narrative-tier-priority {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.narrative-tier-critical {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Setting Modes & Compact Labels (Decluttered Admin & User) */
.setting-mode-title {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--text-main);
}

.setting-mode-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.5;
}

.custom-sec-compact-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s ease;
  user-select: none;
}

.custom-sec-compact-label:hover {
  border-color: #0284c7;
  background: #f8fafc;
}

.custom-sec-compact-label.checked {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0369a1;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.2);
}

/* Progressive Disclosure: Clean Accordion */
.clean-accordion {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.clean-accordion summary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  outline: none;
}

.clean-accordion[open] {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

/* Mini Guidance Banner */
.results-mini-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border-right: 3px solid var(--primary);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 12px;
  line-height: 1.6;
}

/* Propositional Narrative: Compact Sleek Layout */
.narrative-summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.narrative-quote-text {
  font-size: 13px;
  font-weight: 700;
  color: #134e4a;
  line-height: 1.6;
  flex: 1;
}

.narrative-compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.narrative-compact-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.narrative-compact-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.narrative-compact-text {
  font-size: 12px;
  color: #334155;
  line-height: 1.7;
  margin: 0;
}

/* ==========================================================================
   Intro & Guidance Screen Styles
   ========================================================================== */
.intro-card {
  animation: fadeIn 0.3s ease-in-out;
}

.intro-content-body {
  font-size: 14.5px;
  line-height: 1.9;
  color: #334155;
}

.intro-content-body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .intro-card h1 {
    font-size: 18px !important;
  }
  .intro-content-body {
    font-size: 13.5px !important;
    padding: 14px 14px !important;
  }
}

/* ==========================================================================
   Modern Minimal Survey Experience (Exact Match to Pulse Demo with Safaan Colors)
   ========================================================================== */

/* Hide Main Header while inside Survey */
body.in-survey header.header {
  display: none !important;
}

/* Fullscreen Interactive Ambient Background Canvas */
.ambient-canvas-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
  transition: opacity 0.5s ease;
}

/* Compact Centered Survey Container (Matches Demo Proportions) */
.pulse-survey-wrapper {
  position: relative;
  z-index: 10;
  max-width: 480px;
  width: 100%;
  margin: 20px auto 40px auto;
  padding: 0 12px;
  box-sizing: border-box;
}

/* Floating Elevated Survey Card (Compact & Tight) */
.pulse-survey-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 22px;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.07), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
  padding: 22px 24px;
  position: relative;
  box-sizing: border-box;
}

/* Minimal Top Brand Row (Only Logo and Subtle Exit) */
.pulse-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pulse-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
}

.pulse-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.22);
  display: inline-block;
  animation: pulseAura 2s infinite;
}

.pulse-exit-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  transition: all 0.18s ease;
}

.pulse-exit-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Segmented Progress Bar (Exact Match to Demo) */
.pulse-segmented-bar {
  display: flex;
  gap: 5px;
  width: 100%;
  margin: 10px 0 10px 0;
}

.pulse-segment-track {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.pulse-segment-fill {
  height: 100%;
  width: 0%;
  background: #0284c7;
  border-radius: 999px;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pulse-segment-fill.sec-2 {
  background: #0f766e;
}

/* Meta Labels Below Segmented Bar */
.pulse-category-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 14px;
}

.pulse-category-meta-row strong {
  color: #0f172a;
}

/* Category Pill Badge (Matches Demo • Experience Badge, strictly right-aligned) */
.pulse-category-pill {
  display: table !important;
  margin: 0 0 16px 0 !important;
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 14px;
  border: 1px solid #bae6fd;
}

.pulse-category-pill.sec-2 {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

#stepValidationMsg:empty {
  display: none !important;
}

/* Question Area & Fast Snappy Transitions */
.pulse-question-container {
  min-height: 250px;
  position: relative;
}

.pulse-question-content {
  opacity: 1;
  transform: translateX(0);
}

/* Snappy RTL Animations (Next moves towards Left, Prev moves towards Right) */
.pulse-question-content.slide-next {
  animation: pulseSlideNextRTL 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pulse-question-content.slide-prev {
  animation: pulseSlidePrevRTL 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulseSlideNextRTL {
  0% { opacity: 0; transform: translateX(-16px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes pulseSlidePrevRTL {
  0% { opacity: 0; transform: translateX(16px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Question Typography (Matches Bold Prominent Demo Typography) */
.pulse-question-text {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.6;
  margin: 0 0 20px 0;
  text-align: right;
}

/* Vertical Option Cards (Exact Match to Demo Dimensions & Spacing) */
.pulse-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pulse-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  min-height: 56px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  box-shadow: 0 4px 12px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
}

.pulse-option-card:hover {
  border-color: #93c5fd;
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -2px rgba(15, 23, 42, 0.1), 0 3px 6px -2px rgba(15, 23, 42, 0.06);
}

.pulse-option-card:active {
  transform: translateY(0) scale(0.995);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

/* Active / Selected Option State */
.pulse-option-card.selected {
  border-color: #0284c7;
  background: #f0f9ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.18), 0 2px 6px rgba(2, 132, 199, 0.08);
}

.pulse-option-card.sec-2-selected {
  border-color: #0f766e;
  background: #f0fdfa;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.18), 0 2px 6px rgba(15, 118, 110, 0.08);
}

/* Internal elements aligned strictly: [ 1 ] at start (right), label middle, radio end (left) */
.pulse-option-card-start {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.pulse-opt-key {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.pulse-option-card.selected .pulse-opt-key {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
}

.pulse-option-card.sec-2-selected .pulse-opt-key {
  background: #0f766e !important;
  border-color: #0f766e !important;
  color: #ffffff !important;
}

.pulse-opt-label {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  text-align: right;
  flex: 1;
  margin: 0;
}

.pulse-option-card.selected .pulse-opt-label {
  color: #0369a1;
  font-weight: 800;
}

.pulse-option-card.sec-2-selected .pulse-opt-label {
  color: #0f766e;
  font-weight: 800;
}

/* Radio circle on the left */
.pulse-opt-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  position: relative;
  transition: border-color 0.15s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.pulse-opt-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0284c7;
  transform: scale(0);
  transition: transform 0.16s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pulse-option-card.selected .pulse-opt-radio {
  border-color: #0284c7;
}

.pulse-option-card.selected .pulse-opt-radio::after {
  transform: scale(1);
}

.pulse-option-card.sec-2-selected .pulse-opt-radio {
  border-color: #0f766e;
}

.pulse-option-card.sec-2-selected .pulse-opt-radio::after {
  background: #0f766e;
  transform: scale(1);
}

/* Navigation Footer (Exact Proportions to Demo) */
.pulse-survey-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  gap: 10px;
}

.pulse-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  user-select: none;
}

.pulse-nav-btn * {
  pointer-events: none;
}

@keyframes pulseShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.pulse-shake {
  animation: pulseShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.pulse-nav-btn.prev {
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
}

.pulse-nav-btn.prev:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}

.pulse-nav-btn.prev:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pulse-nav-btn.next {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.25);
}

.pulse-nav-btn.next:hover {
  background: #0369a1;
}

.pulse-nav-btn.next.unanswered {
  background: #f1f5f9;
  color: #475569;
  box-shadow: none;
  border: 1px solid #e2e8f0;
}

.pulse-nav-btn.finish {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.25);
}

.pulse-shortcut-legend {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
}

.pulse-shortcut-legend kbd {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 11px;
  color: #475569;
  font-family: inherit;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .pulse-survey-wrapper {
    margin: 10px auto 30px auto;
    padding: 0 10px;
  }
  .pulse-survey-card {
    padding: 18px 16px;
    border-radius: 20px;
  }
  .pulse-question-text {
    font-size: 18px;
  }
  .pulse-option-card {
    padding: 12px 14px;
  }
  .pulse-opt-label {
    font-size: 14px;
  }
  .pulse-shortcut-legend {
    display: none;
  }
}

/* ==========================================================================
   User Code & Confidentiality Styles
   ========================================================================== */

.user-code-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1.5px solid #a7f3d0;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 6px -1px rgba(16, 185, 129, 0.08);
}

.user-code-callout-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid #6ee7b7;
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 4px 16px -2px rgba(16, 185, 129, 0.12);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.user-code-callout-card::after {
  content: "🔒 محرمانه";
  position: absolute;
  top: 10px;
  left: 12px;
  background: #d1fae5;
  color: #065f46;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}

.btn-copy-code {
  background: white !important;
  border: 1.5px solid #6ee7b7 !important;
  color: #047857 !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}

.btn-copy-code:hover {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  transform: translateY(-1px);
}

.code-badge {
  font-family: monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}


/* ==========================================================================
   Internal Modal System (AppDialog) for Alerts & Confirmations
   ========================================================================== */
body.app-dialog-open {
  overflow: hidden !important;
}

.app-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.app-dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.app-dialog-card {
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
  max-width: 440px;
  width: 100%;
  padding: 26px 24px 22px 24px;
  text-align: center;
  position: relative;
  direction: rtl;
  box-sizing: border-box;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-dialog-overlay.active .app-dialog-card {
  transform: scale(1) translateY(0);
}

.app-dialog-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.app-dialog-close:hover {
  background: #f1f5f9;
  color: #334155;
}

.app-dialog-icon-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform 0.2s ease;
}

.app-dialog-overlay.active .app-dialog-icon-wrapper {
  animation: appDialogIconPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes appDialogIconPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Icon type themes */
.app-dialog-icon-danger {
  background: #fee2e2;
  color: #dc2626;
  box-shadow: 0 0 0 6px #fef2f2;
}

.app-dialog-icon-error {
  background: #fee2e2;
  color: #dc2626;
  box-shadow: 0 0 0 6px #fef2f2;
}

.app-dialog-icon-warning {
  background: #fef3c7;
  color: #d97706;
  box-shadow: 0 0 0 6px #fffbeb;
}

.app-dialog-icon-success {
  background: #d1fae5;
  color: #059669;
  box-shadow: 0 0 0 6px #ecfdf5;
}

.app-dialog-icon-info {
  background: #e0f2fe;
  color: #0284c7;
  box-shadow: 0 0 0 6px #f0f9ff;
}

.app-dialog-icon-question {
  background: #e0e7ff;
  color: #4f46e5;
  box-shadow: 0 0 0 6px #eef2ff;
}

.app-dialog-content {
  margin-bottom: 22px;
}

.app-dialog-title {
  font-size: 17.5px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.5;
}

.app-dialog-message {
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  line-height: 1.8;
  white-space: pre-line;
  word-break: break-word;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0 4px;
}

.app-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.app-dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10.5px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  flex: 1;
  user-select: none;
  font-family: inherit;
}

.app-dialog-btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.app-dialog-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.app-dialog-btn-confirm {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.app-dialog-btn-confirm:hover {
  background: #0369a1;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

.app-dialog-btn-confirm.danger {
  background: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.app-dialog-btn-confirm.danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.app-dialog-btn-confirm.warning {
  background: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.app-dialog-btn-confirm.warning:hover {
  background: #d97706;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

.app-dialog-btn-confirm.success {
  background: #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.app-dialog-btn-confirm.success:hover {
  background: #059669;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

@media (max-width: 480px) {
  .app-dialog-card {
    padding: 22px 18px 18px 18px;
    border-radius: 18px;
  }
  .app-dialog-title {
    font-size: 16px;
  }
  .app-dialog-message {
    font-size: 13.5px;
  }
  .app-dialog-btn {
    padding: 9.5px 14px;
    font-size: 13.5px;
  }
}
