/* ---------------------------- */
/* فونت و رنگ‌بندی عمومی */
/* ---------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;600&display=swap');

:root {
  --primary: hsl(318, 80%, 42%);
  --secondary: #43a047;
  --bg: #f7faff;
  --text: #212121;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --transition: 0.3s ease;
}

/* ---------------------------- */
/* بدنه و ساختار کلی */
/* ---------------------------- */
body {
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg);
  direction: rtl;
  color: var(--text);
  margin: 0;
  padding: 0;
  text-align: center;
  margin-top: 40px;
}

/* ---------------------------- */
/* کارت‌ها و کانتینرها */
/* ---------------------------- */
.card, .container {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 40px;
  text-align: center;
  animation: fadeIn 0.6s ease;
}

h1, h2, h3 {
  color: var(--primary);
  margin-bottom: 15px;
}

/* ---------------------------- */
/* دکمه‌ها */
/* ---------------------------- */
.btn, button, input[type=submit] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  transition: var(--transition);
}
.btn:hover, button:hover { background: var(--secondary); }

/* ---------------------------- */
/* فرم‌ها */
/* ---------------------------- */
input[type=text],
input[type=password],
input[type=email],
select {
  width: 100%;
  padding: 10px;
  margin: 8px 0 18px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: 'Vazirmatn', sans-serif;
}
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ---------------------------- */
/* جدول‌ها */
/* ---------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 6px;
}
.table th {
  background: #e3f2fd;
}

/* ---------------------------- */
/* کارت پایان نتایج */
/* ---------------------------- */
.end {
  text-align: center;
  margin-top: 80px;
}
.end h2 {
  color: var(--secondary);
}

/* ---------------------------- */
/* گرید عمومی برای تست‌ها */
/* (ویژه Tile Recall و مشابه‌ها) */
/* ---------------------------- */
.grid {
  display: grid;
  justify-content: center;
  margin: 25px auto 0;
  gap: 6px; /* 🔹 فاصله بین کاشی‌ها ↓ کاهش داده شد */
}
@media (max-width:600px) {
  .grid { gap: 4px; } /* 🔹 در موبایل حتی چسبیده‌تر */
}

/* ---------------------------- */
/* کاشی‌ها (Tile Elements) */
/* ---------------------------- */
.tile {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  background-color: #e0e0e0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: background-color var(--transition), transform 0.2s ease;
}
.tile.active  { background-color: var(--primary); transform: scale(1.05); }
.tile.correct { background-color: var(--secondary); }
.tile.wrong   { background-color: #d32f2f; }

/* ---------------------------- */
/* تایمر یا متن راهنما */
/* ---------------------------- */
.timer {
  font-size: 14px;
  color: #777;
}

/* ---------------------------- */
/* افکت‌های عمومی */
/* ---------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================== */
/* === استایل مخصوص تست Focus Sort Em === */
/* =========================================================== */

.zones-wrapper {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin: 25px 0;
  width: 100%;
  align-items: stretch;
}

/* ✅ نواحی پایدار، غیرقابل گسترش */
.drop-zone {
  flex: 1 1 0;
  position: relative;
  border-radius: 10px;
  padding: 20px;
  height: 180px;
  background: #ffffffee;
  box-shadow: var(--shadow);
  display: block;  /* ❌ دیگر flex نیست تا ارتفاع تغییر نکند */
  transition: var(--transition);
  overflow: hidden;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}
.drop-zone.dragover {
  transform: scale(1.03);
  box-shadow: 0 0 25px #007bff55;
}

/* عنوان و نشانه در ناحیه */
.zone-symbol {
  font-size: 2.5rem;
  width: 100%;
  text-align: center;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

/* کارت‌های انداخته‌شده در ناحیه */
.drop-zone .card-item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* =========================================================== */
/* کارت‌های اصلی (Focus Sort Em و سایر تست‌های درگ‌دراپ) */
/* =========================================================== */
.sort-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.card-item {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s ease;
  font-size: 3em;
  z-index: 5;
}
.card-item.dragging {
  opacity: 0.6;
  transform: scale(1.1);
}

/* =========================================================== */
/* Responsive تنظیمات عمومی برای موبایل */
/* =========================================================== */
@media (max-width: 600px) {
  .zones-wrapper { gap: 18px; }
  .card-item {
    width: 80px;
    height: 80px;
    font-size: 2.4em;
  }
  .drop-zone {
    height: 160px;
  }
  .card, .container { padding: 20px;
    width: 90%;
  }
}
/* =========================================================== */
/* === استایل مخصوص تست Tile Recall === */
/* =========================================================== */

/* انیمیشن‌های کاشی */
@keyframes pulse-correct {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* حالت‌های مختلف کاشی */
.tile.correct {
  background-color: var(--secondary) !important;
  animation: pulse-correct 0.5s ease;
}

.tile.wrong {
  background-color: #d32f2f !important;
  animation: shake 0.5s ease;
}
/* =========================================================== */
/* === استایل مخصوص تست Memory Span Forward === */
/* =========================================================== */

.memory-container {
  max-width: 600px;
  margin: 20px auto;
  animation: fadeInScale 0.5s ease;
}

.memory-header {
  margin-bottom: 20px;
}

.memory-header h2 {
  font-size: 1.8rem;
}

.memory-description {
  color: #666;
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 1.1rem;
}

.number-display-box {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 50px 20px;
  margin: 30px 0;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-display {
  font-size: 10vmin;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.number-display.show {
  transform: scale(1.1);
}

.input-section {
  margin: 20px 0;
  text-align: center;
}

.answer-input {
  font-size: 2.2rem;
  text-align: center;
  width: 100%;
  max-width: 300px;
  padding: 15px;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s ease;
  font-weight: 600;
}

.answer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

.answer-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.feedback-box {
  margin: 20px 0;
  font-weight: 600;
  font-size: 1.4rem;
  min-height: 40px;
  padding: 12px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.feedback-box.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.feedback-box.error {
  background: #ffebee;
  color: #c62828;
}

.hint-text {
  font-size: 1.05rem;
  color: #888;
  margin-top: 10px;
}

/* انیمیشن‌ها */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.stat-box .stat-label {
  font-size: 1rem;
}

.stat-box .stat-value {
  font-size: 2rem;
  font-weight: 700;
}

/* ریسپانسیو */
@media(max-width: 600px){
  .number-display {
    font-size: 18vmin;
  }
  
  .answer-input {
    font-size: 1.8rem;
  }
  
  .memory-container {
    padding: 15px;
  }
  
  .memory-header h2 {
    font-size: 1.5rem;
  }
  
  .memory-description {
    font-size: 1rem;
  }
  
  .feedback-box {
    font-size: 1.2rem;
  }
  
  .hint-text {
    font-size: 0.95rem;
  }
}
/* ========== Attention Stroop Test Styles ========== */

.progress-bar-container {
  width: 90%;
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  margin: 20px auto;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, #10b981 100%);
  transition: width 0.4s ease;
  border-radius: 5px;
}
/* ========== Task Switching Test Styles ========== */

.task-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 30px auto;
}

.btn-task {
  flex: 1 0 120px;
  max-width: 140px;
  height: 50px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-task:hover {
  transform: scale(1.06);
  opacity: 0.9;
}

.btn-task:active {
  transform: scale(0.95);
}

.btn-red {
  background: linear-gradient(135deg, #e63946, #d62828);
}

.btn-blue {
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

.btn-circle {
  background: linear-gradient(135deg, #10b981, #059669);
}

.btn-square {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.guide-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 25px;
  margin-bottom: 20px;
  text-align: right;
  line-height: 1.9;
  box-shadow: var(--shadow);
}

.guide-box h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 1.4rem;
}

.guide-box ul {
  margin: 15px 0;
  padding-right: 20px;
}

.guide-box li {
  margin: 10px 0;
}

.example-symbol {
  display: inline-block;
  margin: 0 8px;
  font-size: 1.8rem;
  font-weight: 700;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.pulse {
  animation: pulse 0.2s ease;
}

@media(max-width: 600px) {
  .btn-task {
    height: 45px;
    font-size: 1rem;
    flex: 1 0 45%;
  }
}
/* ========== Attention Tracking Test Styles ========== */

.tracking-info {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 15px 0;
  min-height: 30px;
  text-align: center;
}

@media(max-width: 700px) {
  .tracking-info {
    font-size: 1.1rem;
  }
}
/* ========== Mental Rotation 2D Test Styles ========== */

.rotation-info {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 15px 0;
  min-height: 35px;
  text-align: center;
  transition: all 0.3s ease;
}

.rotation-hint {
  font-size: 1.05rem;
  color: #6b7280;
  margin: 10px 0;
  line-height: 1.6;
  text-align: center;
  padding: 0 20px;
}

.chart-container {
  width: 90%;
  max-width: 700px;
  margin: 25px auto;
  display: none;
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: slideUp 0.5s ease;
}

#resultChart {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ریسپانسیو */
@media(max-width: 700px) {
  .rotation-info {
    font-size: 1.1rem;
    padding: 0 10px;
  }
  
  .rotation-hint {
    font-size: 0.95rem;
    padding: 0 15px;
  }
  
  .chart-container {
    width: 95%;
    padding: 15px;
  }
}

@media(max-width: 500px) {
  .rotation-info {
    font-size: 1rem;
  }
  
  .rotation-hint {
    font-size: 0.9rem;
  }
}
