/* ==========================================================================
   Page KiiD - Child-Friendly Finance stylesheet
   ========================================================================== */

/* Floating Bubbles Canvas Overlay */
#bubble-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Confetti Particles Canvas Overlay */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Page Wrapper and Main Layout */
.kiid-wrapper {
  position: relative;
  z-index: 2;
  padding: 120px 0 60px;
  min-height: 100vh;
  overflow: hidden;
}

.kiid-header {
  text-align: center;
  margin-bottom: 40px;
}

.kiid-title {
  font-family: 'Outfit', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24 0%, #f472b6 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  animation: floatTitle 3s ease-in-out infinite;
}

.kiid-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Bubbly Navigation Tabs */
.kiid-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.kiid-tab-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 50px;
  border: 2px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kiid-tab-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-gold);
}

.kiid-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #f472b6 100%);
  color: #000;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.kiid-tab-btn.active span {
  animation: bounceEmoji 1s infinite alternate;
}

/* Cards Grid Layout */
.kiid-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  margin-bottom: 50px;
}

/* Card Container */
.kiid-card {
  border-radius: 24px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  min-height: 380px;
  height: auto;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kiid-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* Glowing Neon Borders based on Categories */
.kiid-card[data-cat="basics"] {
  box-shadow: 0 8px 32px 0 rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.kiid-card[data-cat="banking"] {
  box-shadow: 0 8px 32px 0 rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.kiid-card[data-cat="compounding"] {
  box-shadow: 0 8px 32px 0 rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.kiid-card[data-cat="investing"] {
  box-shadow: 0 8px 32px 0 rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.kiid-card[data-cat="habits"] {
  box-shadow: 0 8px 32px 0 rgba(244, 114, 182, 0.15);
  border: 1px solid rgba(244, 114, 182, 0.2);
}
.kiid-card[data-cat="quiz"] {
  box-shadow: 0 8px 32px 0 rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Card Header Section */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-cat-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Custom Tag Styles */
.tag-basics { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.tag-banking { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tag-compounding { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.tag-investing { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.tag-habits { background: rgba(244, 114, 182, 0.15); color: #f472b6; }
.tag-quiz { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Language Switcher on Cards */
.card-lang-switch {
  display: flex;
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.card-lang-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-lang-btn.active {
  background: var(--accent-gold);
  color: #000;
  font-weight: 700;
}

/* Card Body Section */
.card-body-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 0;
}

.card-question {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.card-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Speech Synthesis Controls */
.card-speak-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.card-speak-btn:hover {
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.15);
  transform: scale(1.1);
}

.card-speak-btn.speaking {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  animation: pulseSpeak 1s infinite alternate;
}

/* Interactive Quiz Options styling */
.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  width: 100%;
}

.quiz-option-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-option-btn:hover:not(:disabled) {
  transform: translateX(5px) scale(1.02);
  border-color: var(--primary-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.quiz-option-btn.correct {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  font-weight: 700;
  animation: correctPop 0.4s ease-out;
}

.quiz-option-btn.incorrect {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  font-weight: 700;
  animation: errorShake 0.4s ease-in-out;
}

.quiz-explanation-box {
  margin-top: 15px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.3);
  text-align: left;
  animation: fadeIn 0.4s ease;
}

.quiz-explanation-box strong {
  color: #10b981;
  display: block;
  margin-bottom: 4px;
}

/* Card Footer/Actions Section */
.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 16px;
}



/* Bottom Controls Layout */
.kiid-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.shuffle-btn-container {
  position: relative;
}

.btn-shuffle {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 16px 36px;
  border-radius: 50px;
  background: linear-gradient(135deg, #f472b6 0%, #fbbf24 50%, #3b82f6 100%);
  background-size: 200% auto;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(244, 114, 182, 0.4);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-shuffle:hover {
  background-position: right center;
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 15px 35px rgba(244, 114, 182, 0.6);
}

.btn-shuffle:active {
  transform: translateY(-2px) scale(0.98);
}

.btn-shuffle span.wand-icon {
  display: inline-block;
  transition: transform 0.4s ease;
}

.btn-shuffle:hover span.wand-icon {
  animation: shakeWand 0.5s infinite alternate;
}

/* Progress Tracker Styling */
.kiid-progress-container {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.kiid-progress-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.kiid-progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--bg-card);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.kiid-progress-bar-fill {
  width: 6%;
  height: 100%;
  background: linear-gradient(to right, var(--accent-gold), #f472b6);
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light Theme Enhancements for Kids page */
body.light-theme .kiid-card {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-md);
}

body.light-theme .kiid-tab-btn {
  background-color: rgba(255, 255, 255, 0.9);
}

body.light-theme .card-lang-switch {
  background: #f1f5f9;
}

body.light-theme .quiz-option-btn {
  background: #f8fafc;
}

body.light-theme .quiz-explanation-box {
  background: rgba(16, 185, 129, 0.05);
}

/* Custom Animation Keyframes */
@keyframes floatTitle {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

@keyframes bounceEmoji {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-5px); }
}

@keyframes pulseSpeak {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  100% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

@keyframes shakeWand {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(25deg); }
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

/* Shuffle Transitions */
.card-exit-left {
  animation: cardExitLeft 0.4s forwards cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

.card-enter-right {
  animation: cardEnterRight 0.5s forwards cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes cardExitLeft {
  0% { transform: scale(1) translateX(0); opacity: 1; }
  100% { transform: scale(0.8) translateX(-150px); opacity: 0; }
}

@keyframes cardEnterRight {
  0% { transform: scale(0.8) translateX(150px); opacity: 0; }
  100% { transform: scale(1) translateX(0); opacity: 1; }
}

/* Custom Navigation Glow Style for Nav Action button has been moved to global style.css */

/* Responsive Styles */
@media (max-width: 992px) {
  .kiid-title {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  .kiid-title {
    font-size: 2.2rem;
  }
  .kiid-cards-grid {
    grid-template-columns: 1fr;
    max-width: 450px;
    margin: 0 auto 30px;
  }
  .kiid-card {
    min-height: 360px;
    height: auto;
  }
  .kiid-tab-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
}
