/* ========================================
   CHOTA LEADER - Main Stylesheet
   Deen + Duniya + Development
   ======================================== */

/* ===== CSS VARIABLES ===== */
:root {
  /* Colors - Soft Islamic Palette */
  --bg-cream: #F5F0E6;
  --bg-light: #FDFBF7;
  --green-primary: #4A7C59;
  --green-dark: #3D5A45;
  --green-light: #7BA38C;
  --gold-accent: #D4A853;
  --gold-light: #F0D78C;
  --brown-warm: #8B7355;
  --text-dark: #2C3E2D;
  --text-light: #5A6B5C;
  --white: #FFFFFF;
  --error-soft: #E8A0A0;
  --success-soft: #A0D4A0;
  
  /* Fonts */
  --font-title: 'Baloo 2', cursive;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --font-playful: 'Quicksand', sans-serif;
  --font-mantra: 'Fredoka', sans-serif;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 50%;
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-cream);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== GOOGLE FONTS IMPORT ===== */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Fredoka:wght@400;500;600&family=Nunito:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Quicksand:wght@400;500;600&display=swap');

/* ===== LAYOUT ===== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  min-height: 100vh;
}

.page {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 0 4px 20px rgba(74, 124, 89, 0.1);
}

/* ===== TYPOGRAPHY ===== */
.title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  color: var(--green-primary);
  text-align: center;
  margin-bottom: var(--space-md);
}

.subtitle {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: var(--space-sm);
}

.heading {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brown-warm);
  margin-bottom: var(--space-sm);
}

.body-text {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.8;
}

.urdu-text {
  font-size: 1.1rem;
  direction: rtl;
  text-align: right;
  font-weight: 500;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-dark) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.header-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--white);
  font-weight: 700;
}

.header-icon {
  width: 40px;
  height: 40px;
  background: var(--gold-accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(74, 124, 89, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 124, 89, 0.4);
}

.btn-secondary {
  background: var(--bg-cream);
  color: var(--green-primary);
  border: 2px solid var(--green-primary);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold-light) 100%);
  color: var(--text-dark);
}

.btn-full {
  width: 100%;
  display: block;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--green-primary);
}

.card-gold {
  border-left-color: var(--gold-accent);
  background: linear-gradient(135deg, var(--white) 0%, #FDF8E8 100%);
}

.card-story {
  background: linear-gradient(135deg, #F8F6F0 0%, var(--white) 100%);
  border-left: 4px solid var(--brown-warm);
  position: relative;
  overflow: hidden;
}

.card-story::before {
  content: '📖';
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: 1.5rem;
  opacity: 0.3;
}

/* ===== ACTIVITY ELEMENTS ===== */
.activity-container {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 2px dashed var(--green-light);
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.choice-btn {
  background: var(--white);
  border: 3px solid var(--green-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.choice-btn:hover {
  border-color: var(--green-primary);
  transform: scale(1.02);
}

.choice-btn.selected {
  border-color: var(--gold-accent);
  background: linear-gradient(135deg, #FDF8E8 0%, var(--white) 100%);
}

.choice-btn.correct {
  border-color: var(--green-primary);
  background: linear-gradient(135deg, #E8F5EA 0%, var(--white) 100%);
  animation: star-glow 0.5s ease;
}

.choice-btn.try-again {
  animation: gentle-shake 0.5s ease;
}

@keyframes star-glow {
  0% { box-shadow: 0 0 0 rgba(212, 168, 83, 0); }
  50% { box-shadow: 0 0 30px rgba(212, 168, 83, 0.6); }
  100% { box-shadow: 0 0 10px rgba(212, 168, 83, 0.2); }
}

@keyframes gentle-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.star {
  font-size: 2rem;
  display: inline-block;
  transition: all 0.3s ease;
}

.star.earned {
  animation: star-pop 0.5s ease;
  color: var(--gold-accent);
}

@keyframes star-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ===== MANTRA SECTION ===== */
.mantra-box {
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-dark) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.mantra-box::before {
  content: '✨';
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 1.5rem;
  opacity: 0.5;
}

.mantra-box::after {
  content: '✨';
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 1.5rem;
  opacity: 0.5;
}

.mantra-text {
  font-family: var(--font-mantra);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.8;
  margin-bottom: var(--space-md);
}

/* ===== PARENT MODE ===== */
.parent-section {
  background: linear-gradient(135deg, #FFF8E7 0%, #FDF5E6 100%);
  border: 2px solid var(--gold-accent);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
  display: none;
}

.parent-section.visible {
  display: block;
  animation: fadeIn 0.5s ease;
}

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

.parent-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.parent-icon {
  font-size: 1.5rem;
}

.parent-title {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--brown-warm);
}

.parent-unlock-btn {
  background: var(--gold-accent);
  color: var(--white);
  font-size: 0.9rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
  background: var(--bg-cream);
  border-radius: var(--radius-full);
  height: 12px;
  margin: var(--space-md) 0;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--green-light) 0%, var(--green-primary) 100%);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ===== NAVIGATION ===== */
.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  display: flex;
  justify-content: space-around;
  padding: var(--space-md);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  transition: all 0.3s ease;
}

.nav-item.active {
  color: var(--green-primary);
}

.nav-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* ===== IMAGES ===== */
.illustration {
  width: 100%;
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--green-light);
}

/* ===== MESSAGES ===== */
.message {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin: var(--space-md) 0;
  text-align: center;
  font-weight: 500;
}

.message-success {
  background: var(--success-soft);
  color: var(--green-dark);
}

.message-info {
  background: #E8E8F5;
  color: var(--text-dark);
}

/* ===== CHAPTER LIST ===== */
.chapter-list {
  list-style: none;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--white);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  border-left: 4px solid var(--green-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.chapter-item:hover {
  border-left-color: var(--green-primary);
  transform: translateX(5px);
}

.chapter-item.completed {
  border-left-color: var(--gold-accent);
}

.chapter-number {
  width: 40px;
  height: 40px;
  background: var(--green-light);
  color: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.chapter-item.completed .chapter-number {
  background: var(--gold-accent);
}

.chapter-info {
  flex: 1;
}

.chapter-title-text {
  font-weight: 600;
  color: var(--text-dark);
}

.chapter-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ===== LANDING PAGE SPECIFIC ===== */
.landing-hero {
  text-align: center;
  padding: var(--space-xxl) var(--space-md);
  background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-cream) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.landing-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-dark) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 8px 30px rgba(74, 124, 89, 0.3);
}

.landing-tagline {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.feature-list {
  text-align: left;
  margin: var(--space-lg) 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.feature-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.feature-text {
  font-size: 0.95rem;
}

/* ===== INSTALL PROMPT ===== */
.install-prompt {
  position: fixed;
  bottom: 80px;
  left: var(--space-md);
  right: var(--space-md);
  background: var(--green-primary);
  color: var(--white);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 99;
}

.install-prompt.show {
  display: flex;
}

.install-text {
  font-size: 0.9rem;
}

.install-btn {
  background: var(--gold-accent);
  color: var(--text-dark);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.install-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
  .title { font-size: 1.75rem; }
  .mantra-text { font-size: 1.25rem; }
  .choice-grid { grid-template-columns: 1fr; }
}

/* ===== SAFE AREA (NOTCH) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
  .container {
    padding-top: calc(var(--space-md) + env(safe-area-inset-top));
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  
  .nav-bottom {
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}
