/* Cerdikids - Playful & Premium Learning Theme */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Nunito:wght@400;700&display=swap');

:root {
  /* Vibrant Palette */
  --primary-blue: #4CC9F0;
  --primary-pink: #F72585;
  --primary-purple: #7209B7;
  --primary-yellow: #FFD166;
  --primary-green: #06D6A0;

  /* UI Colors */
  --bg-color: #F8F9FA;
  --card-bg: #FFFFFF;
  --text-main: #2B2D42;
  --text-light: #8D99AE;

  /* Spacing & Borders */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.15);

  /* Fonts */
  --font-display: 'Fredoka', cursive;
  --font-body: 'Nunito', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-color);
  color: var(--text-main);
  background-image: radial-gradient(var(--primary-blue) 1px, transparent 1px), radial-gradient(var(--primary-pink) 1px, transparent 1px);
  background-position: 0 0, 25px 25px;
  background-size: 50px 50px;
  background-color: #f0f8ff;
  /* Light azure tint */
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
.fun-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-purple);
}

button {
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  outline: none;
}

/* Layout Containers */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.logo {
  font-size: 2rem;
  color: var(--primary-pink);
  text-decoration: none;
  letter-spacing: 1px;
}

.star-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFF9E6;
  border: 2px solid var(--primary-yellow);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 1.5rem;
  color: #FFAA00;
  font-weight: 700;
}

.star-icon {
  width: 32px;
  height: 32px;
  fill: var(--primary-yellow);
  filter: drop-shadow(0 2px 4px rgba(255, 200, 0, 0.4));
  animation: float 3s ease-in-out infinite;
}

/* Views (SPA pages) */
.view-section {
  display: none;
  /* Hidden by default */
  animation: fadeIn 0.5s ease-out;
}

.view-section.active {
  display: block;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(to right, var(--primary-blue), var(--primary-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.5rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* Buttons */
.btn-primary {
  background: var(--primary-pink);
  color: white;
  padding: 1rem 3rem;
  font-size: 1.5rem;
  border-radius: 50px;
  box-shadow: 0 10px 20px rgba(247, 37, 133, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 25px rgba(247, 37, 133, 0.4);
}

.btn-secondary {
  background: var(--primary-blue);
  color: white;
  padding: 0.8rem 2rem;
  font-size: 1.2rem;
  border-radius: 50px;
  margin-top: 10px;
  box-shadow: 0 8px 16px rgba(76, 201, 240, 0.3);
  transition: transform 0.2s;
}

.btn-secondary:hover {
  transform: translateY(-3px);
}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.game-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  border: 4px solid transparent;
}

.game-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-yellow);
}

.game-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}

.game-card h3 {
  font-size: 1.8rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

/* Game Area */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-height: 400px;
  justify-content: center;
}

.game-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 2rem;
}

.back-btn {
  background: transparent;
  color: var(--text-light);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.back-btn:hover {
  color: var(--primary-blue);
}

/* Specific Game Elements */
.option-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-option {
  width: 100px;
  height: 100px;
  background: #f0f0f0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.game-option:hover {
  transform: scale(1.1);
}

.game-option.correct {
  background: var(--primary-green);
  color: white;
  animation: pop 0.3s;
}

.game-option.wrong {
  background: var(--primary-pink);
  color: white;
  animation: shake 0.3s;
}

/* Quiz Option (Text based) */
.quiz-option {
  width: auto !important;
  height: auto !important;
  min-width: 200px;
  padding: 1rem 2rem;
  font-size: 1.5rem !important;
  border-radius: 50px;
  background: white;
  border: 2px solid #e0e0e0;
}

.quiz-option:hover {
  border-color: var(--primary-blue);
  background: #e3f2fd;
}

/* Dashboard Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.dash-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 15px;
  border: 1px solid #eee;
}

.dash-card h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}

.setting-item {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-btn {
  background: #ccc;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  color: white;
}

.toggle-btn.active {
  background: var(--primary-green);
}

.toggles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-pill {
  background: white;
  border: 2px solid #eee;
  padding: 8px 16px;
  border-radius: 20px;
  color: #888;
  transition: all 0.2s;
}

.toggle-pill.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: white;
  padding: 3rem;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}

.modal-card input {
  font-size: 2rem;
  padding: 0.5rem;
  width: 100px;
  text-align: center;
  margin: 1rem 0;
  border: 2px solid var(--text-light);
  border-radius: var(--radius-sm);
}

/* Animations */
@keyframes float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 1rem;
    flex-direction: column;
    gap: 10px;
  }

  .mascot-container {
    bottom: 10px;
    right: 10px;
    transform: scale(0.8);
  }
}

/* Mascot */
.mascot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  cursor: pointer;
  transition: transform 0.3s;
}

.mascot-container:hover {
  transform: scale(1.1);
}

.mascot-body {
  font-size: 5rem;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.2));
  animation: bounce 3s infinite;
}

.mascot-bubble {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: white;
  padding: 1rem;
  border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
  box-shadow: var(--shadow-md);
  width: 200px;
  font-size: 1rem;
  color: var(--text-main);
  display: none;
  animation: fadeIn 0.3s;
}

.mascot-bubble.active {
  display: block;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Badges */
.badges-section {
  margin-top: 2rem;
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.badge-grid {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.badge {
  text-align: center;
  width: 100px;
  opacity: 0.5;
  filter: grayscale(1);
  transition: all 0.3s;
}

.badge.unlocked {
  opacity: 1;
  filter: grayscale(0);
  transform: scale(1.1);
}

.badge-icon {
  font-size: 3rem;
  display: block;
}

.badge-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--text-main);
}

/* Memory Game Cards */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}

.memory-card {
  background: var(--primary-blue);
  height: 100px;
  width: 100px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: transparent;
  /* Hide content when flipped down */
  transition: transform 0.6s, background 0.3s;
  transform-style: preserve-3d;
  box-shadow: var(--shadow-sm);
}

.memory-card.flipped,
.memory-card.matched {
  background: white;
  color: var(--text-main);
  transform: rotateY(180deg);
}

.memory-card.matched {
  background: var(--primary-green);
  animation: pop 0.5s;
}

/* Timer */
.timer-container {
  width: 100%;
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  margin-bottom: 20px;
  overflow: hidden;
  display: none;
  /* Hidden by default */
}

.timer-container.active {
  display: block;
}

.timer-bar {
  height: 100%;
  background: var(--primary-pink);
  width: 100%;
  transition: width 1s linear;
}

.timer-bar.warning {
  background: var(--primary-yellow);
}

.timer-bar.danger {
  background: #ff0000;
}

/* Drag & Drop Game */
.drag-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  margin-top: 2rem;
  gap: 20px;
}

.draggable-item {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.draggable-item:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.drop-target {
  width: 120px;
  height: 120px;
  border: 3px dashed #ccc;
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  background: #fff;
  transition: all 0.3s;
}

.drop-target.drag-over {
  border-color: var(--primary-blue);
  background: #e3f2fd;
  transform: scale(1.05);
}

.drop-target.correct {
  border-color: var(--primary-green);
  background: #e8f5e9;
}
