/* ==========================================================================
   منظومة حكواتي الأطفال (رفيق)
   الملف: frontend-pages/css/style.css
   الدور: الهوية البصرية المتكاملة (شاشة التهيئة والتسجيل + مسرح الحكواتي التفاعلي)
   الميزات: تصميم مبهج للأطفال + بطاقات لمسية متجاوبة للموبايل والتابلت +
           أنماط كرتونية مرنة ومؤثرات حركية خفيفة الوزن
   ========================================================================== */

:root {
  --bg-primary: #1a0b2e;
  --bg-stage: #261245;
  --brand-purple: #4a148c;
  --brand-purple-light: #7b1fa2;
  --accent-gold: #ffc107;
  --accent-gold-hover: #ffb300;
  --accent-pink: #e91e63;
  --accent-coral: #ff5252;
  --text-light: #ffffff;
  --text-dark: #212529;
  --surface-card: #ffffff;
  --border-glass: rgba(255, 255, 255, 0.15);
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.theater-body {
  font-family: 'Tajawal', sans-serif;
  background: radial-gradient(circle at center, var(--bg-stage) 0%, var(--bg-primary) 100%);
  color: var(--text-light);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. شاشة التهيئة والتسجيل المخصصة (Dedicated Onboarding Screen)
   ========================================================================== */

.onboarding-screen {
  background: radial-gradient(circle at 50% 30%, #3b185f 0%, #17072b 100%);
  position: relative;
  z-index: 5;
}

.onboarding-card-wrapper {
  max-width: 520px;
  background: var(--surface-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

.onboarding-card-header {
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-light) 100%);
  border-bottom: 3px solid var(--accent-gold);
}

.brand-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
}

/* شريط تقدم خطوات المعالج (Wizard Stepper) */
.wizard-stepper {
  height: 8px;
}

.step-dot {
  width: 28px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.step-dot.active {
  width: 44px;
  background: var(--accent-gold);
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.6);
}

.icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* حقول الإدخال */
.custom-input {
  background-color: #f8f9fa;
  border: 2px solid #e9ecef;
  color: var(--text-dark);
  font-weight: 500;
  padding: 0.85rem 1.15rem;
  transition: all 0.25s ease;
}

.custom-input:focus {
  background-color: #ffffff;
  border-color: var(--brand-purple-light);
  box-shadow: 0 0 0 4px rgba(123, 31, 162, 0.15);
}

/* بطاقات اختيار الجنس (بطل / بطلة) */
.btn-outline-gender {
  border: 2.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-outline-gender:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.gender-title {
  font-size: 1.05rem;
  color: #1e293b;
}

.gender-hint {
  font-size: 0.75rem;
}

.btn-check:checked + .btn-outline-gender {
  background: #fdf2f8;
  border-color: var(--accent-pink);
  box-shadow: 0 8px 20px rgba(233, 30, 99, 0.18);
  transform: translateY(-2px);
}

.btn-check#gender-male:checked + .btn-outline-gender {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

/* الزر التفاعلي الرئيسي للمراحل */
.btn-hero-action {
  background: linear-gradient(135deg, var(--brand-purple-light) 0%, var(--brand-purple) 100%);
  border: none;
  font-size: 1.1rem;
  transition: all 0.25s ease;
}

.btn-hero-action:hover {
  background: linear-gradient(135deg, #8e24aa 0%, #6a1b9a 100%);
  box-shadow: 0 10px 25px rgba(74, 20, 140, 0.35);
  transform: translateY(-1px);
}

.btn-hero-action:active {
  transform: translateY(1px);
}

/* ==========================================================================
   2. مسرح الحكواتي التفاعلي (Live Theater Stage)
   ========================================================================== */

.theater-screen {
  background: radial-gradient(circle at center, var(--bg-stage) 0%, var(--bg-primary) 100%);
}

/* شريط الرأس */
.top-theater-bar {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 10;
}

.stars-badge, 
.child-badge {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50rem;
  border: 1px solid var(--border-glass);
}

.star-icon {
  font-size: 1.3rem;
}

/* المسرح المركزي */
.theater-stage {
  min-height: calc(100vh - 65px);
}

.lesson-title {
  font-size: 1.6rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.text-shadow-lg {
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* منطقة كائن الشخصية */
.character-arena {
  width: 100%;
  max-width: 440px;
  margin: auto;
  min-height: 350px;
}

.character-rig-container {
  width: 100%;
  height: 350px;
  position: relative;
}

/* كروت التعلم المنبثقة (Tool Call: show_visual_card) */
.visual-card-wrapper {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 370px;
  z-index: 25;
}

.visual-learning-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: 2rem !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
}

/* لوحة رسم وتتبع الحرف بإصبع الطفل */
#letter-trace-canvas {
  touch-action: none;
  cursor: crosshair;
  background-color: #fafafa;
}

/* بالون الحوار */
.dialogue-bubble {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 2.5px solid var(--accent-gold);
  max-width: 88%;
}

/* زر التحدث الرئيسي */
.btn-hero-talk {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--accent-pink) 0%, #9c27b0 100%);
  box-shadow: 0 10px 30px rgba(233, 30, 99, 0.55);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hero-talk:active {
  transform: scale(0.92);
}

/* مرسام الموجات الصوتية */
.audio-wave-bars .bar {
  display: inline-block;
  width: 5px;
  height: 24px;
  background-color: var(--accent-gold);
  border-radius: 4px;
  animation: wavePulse 1s ease-in-out infinite alternate;
}

.audio-wave-bars .bar-1 { animation-delay: 0.1s; }
.audio-wave-bars .bar-2 { animation-delay: 0.3s; }
.audio-wave-bars .bar-3 { animation-delay: 0.2s; }
.audio-wave-bars .bar-4 { animation-delay: 0.4s; }
.audio-wave-bars .bar-5 { animation-delay: 0.15s; }

@keyframes wavePulse {
  0% { height: 6px; opacity: 0.4; }
  100% { height: 30px; opacity: 1; }
}

/* طبقة الاحتفال البصري بالنجوم */
.celebration-overlay {
  background: rgba(15, 3, 30, 0.88);
  backdrop-filter: blur(12px);
  z-index: 1050;
}

/* ==========================================================================
   3. تحسينات التجاوب لشاشات الموبايل والتابلت (Responsive Tweaks)
   ========================================================================== */

@media (max-width: 576px) {
  .onboarding-card-wrapper {
    border-radius: 1.5rem !important;
  }
  
  .onboarding-card-body {
    padding: 1.5rem 1.25rem !important;
  }
  
  .character-rig-container {
    height: 310px;
  }

  .lesson-title {
    font-size: 1.35rem;
  }

  .btn-hero-talk {
    width: 82px;
    height: 82px;
  }
}