/* ====================================================================
   Duolingo Premium Style Design System (style.css)
   6. Sınıf Oyunlaştırılmış Öğrenme Dünyası
   ==================================================================== */

:root {
  /* Renk Paleti (Duolingo Marka Tonları) */
  --green: hsl(142, 70%, 48%);
  --green-dk: hsl(142, 70%, 38%);
  --green-lt: hsl(142, 70%, 95%);
  
  --purple: #7c3aed;
  --purple-dk: #6d28d9;
  --purple-lt: #f5f3ff;
  
  --orange: hsl(32, 90%, 52%);
  --orange-dk: hsl(32, 90%, 42%);
  --orange-lt: hsl(32, 90%, 95%);
  
  --red: hsl(355, 75%, 50%);
  --red-dk: hsl(355, 75%, 40%);
  --red-lt: hsl(355, 75%, 95%);
  
  --blue: hsl(202, 85%, 50%);
  --blue-dk: hsl(202, 85%, 40%);
  --blue-lt: hsl(202, 85%, 95%);
  
  --yellow: hsl(48, 95%, 48%);
  --yellow-dk: hsl(48, 95%, 38%);
  --yellow-lt: hsl(48, 95%, 95%);

  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Dinamik Tema Değişkenleri (JavaScript ile güncellenir) */
  --theme-color: var(--purple);
  --theme-color-dk: var(--purple-dk);
  --theme-color-lt: var(--purple-lt);

  /* Tasarım Standartları */
  --font-sans: 'Nunito', system-ui, -apple-system, sans-serif;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

/* Reset & Temel Kurallar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--gray-50);
  color: var(--gray-800);
  overflow-x: hidden;
  animation: pageFadeIn 0.35s ease-out forwards;
}

/* Sayfalar Arası Kademeli Geçiş Animasyonları */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Safe Area Helper */
.safe-area {
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* ===============================================
   Taktil 3D Butonlar (Duolingo Style Buttons)
   =============================================== */
.btn-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xl);
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: filter 0.2s, transform 0.1s, border-bottom-width 0.1s;
  cursor: pointer;
  border: 2px solid transparent;
  outline: none;
  font-size: 0.9rem;
}

.btn-3d:active {
  transform: translateY(4px);
}

/* Mor Buton */
.btn-purple {
  background: var(--purple);
  color: var(--white);
  border-bottom: 5px solid var(--purple-dk);
  border-color: var(--purple-dk);
}
.btn-purple:active {
  border-bottom-width: 1px;
}

/* Yeşil Buton */
.btn-green {
  background: var(--green);
  color: var(--white);
  border-bottom: 5px solid var(--green-dk);
  border-color: var(--green-dk);
}
.btn-green:active {
  border-bottom-width: 1px;
}

/* Turuncu Buton */
.btn-orange {
  background: var(--orange);
  color: var(--white);
  border-bottom: 5px solid var(--orange-dk);
  border-color: var(--orange-dk);
}
.btn-orange:active {
  border-bottom-width: 1px;
}

/* Kırmızı Buton */
.btn-red {
  background: var(--red);
  color: var(--white);
  border-bottom: 5px solid var(--red-dk);
  border-color: var(--red-dk);
}
.btn-red:active {
  border-bottom-width: 1px;
}

/* ===============================================
   Profil Giriş Arayüzü (index.html)
   =============================================== */
.profile-card {
  border: 2px solid var(--gray-200);
  border-bottom: 6px solid var(--gray-200);
  transition: all 0.2s ease;
}

.profile-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: var(--shadow-md);
}

.profile-card:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* ===============================================
   Masaüstü / Yatay Tablet 3 Sütun Lobi Tasarımı
   =============================================== */
.sidebar-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--white);
  border-right: 2px solid var(--gray-200);
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-xl);
  font-weight: 1000;
  font-size: 0.95rem;
  color: var(--gray-500);
  background: transparent;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.menu-item.active {
  background: var(--theme-color-lt);
  border-color: var(--theme-color-lt);
  color: var(--theme-color-dk);
}

/* 3 Sütunlu Lobi Dashboard */
.dashboard-layout-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 1.5rem;
}

.dashboard-main-column {
  flex: 1;
  min-w: 0;
}

.dashboard-side-column {
  display: none;
}

@media (min-width: 1024px) {
  .dashboard-layout-wrapper {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }
  
  .dashboard-side-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 320px;
    position: sticky;
    top: 24px;
    flex-shrink: 0;
  }
}

/* ===============================================
   Ders Seçim Barı (Horizontal Subject Selector)
   =============================================== */
.subject-chip {
  cursor: pointer;
  font-weight: 900;
  border-radius: var(--r-xl);
  transition: all 0.15s ease;
}

.subject-chip.active {
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.subject-chip:active {
  transform: translateY(1px);
}

/* ===============================================
   Harita Patikası (Game Path Level Circular Nodes)
   =============================================== */
.map-node-circle {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  border: 2px solid var(--gray-200);
  border-bottom: 7px solid var(--gray-300);
  background: var(--white);
  transition: all 0.2s ease;
  cursor: pointer;
  z-index: 10;
}

.map-node-circle:active:not(.locked) {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.map-node-circle.current {
  animation: pulseActive 2.5s infinite alternate;
}

.map-node-circle.locked {
  background: var(--gray-200) !important;
  border-color: var(--gray-200) !important;
  border-bottom-color: var(--gray-300) !important;
  color: var(--gray-400) !important;
  cursor: not-allowed;
}

.map-node-circle.completed {
  border-color: var(--green);
  border-bottom-color: var(--green-dk);
}

.map-node-crown {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 1.1rem;
  transform: rotate(15deg);
  animation: bounceSlow 2s infinite alternate;
}

@keyframes pulseActive {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(124, 58, 237, 0);
  }
}

@keyframes bounceSlow {
  from { transform: translateY(0) rotate(15deg); }
  to { transform: translateY(-4px) rotate(15deg); }
}

/* ===============================================
   Konu Anlatım Sayfası (Theory Summary Panel)
   =============================================== */
.theory-banner {
  background: linear-gradient(135deg, var(--purple-dk), var(--purple));
  color: var(--white);
  position: relative;
}

.theory-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
}

.theory-badge {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  border-radius: var(--r-lg);
}

/* Ön ve Arka Yüzlü Flashcard Stilleri */
.flashcard-container {
  perspective: 1000px;
}

.flashcard-card {
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.backface-hidden {
  backface-visibility: hidden;
}

/* ===============================================
   İki Sütunlu Yatay Quiz Arayüzü (quiz-screen)
   =============================================== */
.quiz-layout-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 1.5rem;
}

.quiz-left-column {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.quiz-right-column {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

@media (min-width: 768px) {
  .quiz-layout-wrapper {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }
  
  .quiz-left-column {
    width: 42%;
    position: sticky;
    top: 24px;
  }
  
  .quiz-right-column {
    flex: 1;
  }
}

/* Çoktan Seçmeli Buton Kartları (Option Buttons) */
.option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-bottom: 5px solid var(--gray-200);
  border-radius: var(--r-xl);
  font-weight: 800;
  text-align: left;
  transition: all 0.15s ease;
  cursor: pointer;
  outline: none;
}

.option-btn:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--theme-color);
}

.option-btn:active:not(:disabled) {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-lg);
  border: 2px solid var(--gray-200);
  color: var(--gray-400);
  font-size: 0.8rem;
  font-weight: 900;
}

/* Seçim ve Sonuç Renkleri */
.option-btn.correct {
  background: var(--green-lt) !important;
  border-color: var(--green) !important;
  border-bottom-color: var(--green-dk) !important;
  color: var(--green-dk) !important;
}

.option-btn.wrong {
  background: var(--red-lt) !important;
  border-color: var(--red) !important;
  border-bottom-color: var(--red-dk) !important;
  color: var(--red-dk) !important;
}

/* ===============================================
   Müteferrik: Kelime Sıralama (Sentence Builder)
   =============================================== */
.word-shelf {
  min-height: 56px;
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.word-blocks-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.word-block {
  display: inline-block;
  padding: 10px 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-bottom: 4px solid var(--gray-200);
  border-radius: var(--r-lg);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.1s ease;
}

.word-block:active:not(.used) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.word-block.used {
  background: var(--gray-100) !important;
  border-color: var(--gray-100) !important;
  color: var(--gray-400) !important;
  border-bottom-width: 2px !important;
  cursor: not-allowed;
}

/* ===============================================
   Müteferrik: Kart Eşleştirme (Matching Pairs)
   =============================================== */
.matching-container {
  display: grid;
  grid-template-cols: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.matching-card {
  padding: 14px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-bottom: 4px solid var(--gray-200);
  border-radius: var(--r-xl);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.matching-card.selected {
  background: var(--blue-lt) !important;
  border-color: var(--blue) !important;
  border-bottom-color: var(--blue-dk) !important;
  color: var(--blue-dk) !important;
  transform: scale(1.03);
}

.matching-card.correct {
  background: var(--green-lt) !important;
  border-color: var(--green) !important;
  border-bottom-color: var(--green-dk) !important;
  color: var(--green-dk) !important;
}

.matching-card.wrong {
  background: var(--red-lt) !important;
  border-color: var(--red) !important;
  border-bottom-color: var(--red-dk) !important;
  color: var(--red-dk) !important;
}

/* ===============================================
   Mascot Speech Bubbles
   =============================================== */
.speech-bubble {
  position: relative;
  background: var(--gray-100);
  border-radius: var(--r-xl);
  padding: 14px 18px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gray-700);
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  background: var(--gray-100);
}

.animate-float {
  animation: floatAnim 3s ease-in-out infinite alternate;
}

@keyframes floatAnim {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

/* ===============================================
   Liderlik Ligi Sıralama Kartları
   =============================================== */
.leaderboard-row {
  transition: background-color 0.15s ease;
}

.leaderboard-row.my-row {
  background-color: var(--purple-lt);
  border-left: 4px solid var(--purple);
}

.leaderboard-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-weight: 1000;
  font-size: 0.85rem;
  border-radius: var(--r-full);
}

.leaderboard-rank.rank-1 { background: #ffd700; color: #7f6a00; }
.leaderboard-rank.rank-2 { background: #c0c0c0; color: #5a5a5a; }
.leaderboard-rank.rank-3 { background: #cd7f32; color: #5e3a16; }
.leaderboard-rank.rank-other { background: var(--gray-100); color: var(--gray-500); }

.leaderboard-tag {
  font-size: 0.6rem;
  font-weight: 1000;
  padding: 1px 4px;
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: 4px;
  margin-left: 6px;
}

/* ===============================================
   Teşvik Pencereleri (Encouragement Box)
   =============================================== */
.encouragement-box {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--white);
  border: 3px solid var(--theme-color);
  border-radius: var(--r-2xl);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: max-content;
  max-width: 90vw;
}

.encouragement-box.show {
  transform: translateX(-50%) translateY(0);
}

.encouragement-mascot {
  font-size: 2.5rem;
}

.encouragement-text h4 {
  font-weight: 1000;
  color: var(--gray-900);
  font-size: 1rem;
}

.encouragement-text p {
  font-weight: 800;
  color: var(--gray-500);
  font-size: 0.8rem;
  margin-top: 2px;
}

/* Confetti particles */
.confetti-particle {
  width: 8px;
  height: 12px;
  opacity: 0.85;
}

@keyframes fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
.animate-fall {
  animation: fall 3s linear forwards;
}

/* Floating XP text effect */
@keyframes floatUp {
  0% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -60px); opacity: 0; }
}
.animate-float {
  animation: floatUp 1.2s ease-out forwards;
}

/* Shake animation for errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.animate-shake {
  animation: shake 0.4s ease-in-out;
}

/* Fade in up entry animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fadeInUp {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* ===============================================
   Karanlık Mod (Dark Mode) Desteği
   =============================================== */
body.dark-mode {
  background-color: #121212 !important;
  color: #E5E5E5 !important;
}

body.dark-mode .bg-white { background-color: #161616 !important; }
body.dark-mode .text-gray-900 { color: #FFFFFF !important; }
body.dark-mode .text-gray-800 { color: #E5E5E5 !important; }
body.dark-mode .text-gray-700 { color: #CCCCCC !important; }
body.dark-mode .text-gray-600 { color: #AAAAAA !important; }
body.dark-mode .text-gray-500 { color: #888888 !important; }
body.dark-mode .border-gray-200 { border-color: #2D2D2D !important; }
body.dark-mode .border-gray-100 { border-color: #222222 !important; }
body.dark-mode .bg-gray-100 { background-color: #121212 !important; }
body.dark-mode .bg-gray-50 { background-color: #141414 !important; }

body.dark-mode .profile-card { border-color: #2D2D2D; border-bottom-color: #333333; }
body.dark-mode .profile-card:hover { border-color: var(--purple); }
body.dark-mode .sidebar-nav { background: #161616; border-color: #2D2D2D; }
body.dark-mode .menu-item { color: #AAAAAA; }
body.dark-mode .menu-item:hover { background: #252525; color: #FFFFFF; }
body.dark-mode .menu-item.active { background: #2E1B4E; color: #D6A8FF; }

body.dark-mode .option-btn { background: #1E1E1E; border-color: #333333; border-bottom-color: #252525; color: #E5E5E5; }
body.dark-mode .option-btn:hover:not(:disabled) { border-color: var(--theme-color); }
body.dark-mode .matching-card { background: #1E1E1E; border-color: #333333; border-bottom-color: #252525; color: #E5E5E5; }
body.dark-mode .word-shelf { border-color: #333333; }
body.dark-mode .word-block { background: #1E1E1E; border-color: #333333; border-bottom-color: #252525; color: #E5E5E5; }
body.dark-mode .word-block.used { background: #151515 !important; border-color: #222222 !important; }
body.dark-mode .speech-bubble { background: #252525; color: #E5E5E5; }
body.dark-mode .speech-bubble::before { background: #252525; }

/* -----------------------------------------------
   Mobile Media Queries
   ----------------------------------------------- */
@media (max-width: 420px) {
  .option-btn { padding: 12px 14px; font-size: 0.9rem; }
  #question-text { font-size: 1rem; }
  .map-node-circle { width: 72px; height: 72px; font-size: 1.8rem; }
}
