/* ==========================================================================
   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;
  }
}

/* ==========================================================================
   Separate KiiD Sections: Questions & Quiz Styles
   ========================================================================== */

/* Top level Mode Selector */
.kiid-mode-selector {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
  width: 100%;
}

.mode-btn {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-radius: 20px;
  border: 2px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mode-btn:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-md);
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.mode-icon {
  font-size: 2.2rem;
  transition: transform 0.3s ease;
}

.mode-btn:hover .mode-icon {
  transform: scale(1.15) rotate(5deg);
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Quiz Section Dashboard */
.quiz-dashboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 20px 30px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
  gap: 20px;
  flex-wrap: wrap;
}

.quiz-score-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
  max-width: 500px;
}

.quiz-score-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.score-stars {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.quiz-progress-wrapper {
  width: 100%;
}

.quiz-progress-bar-bg {
  width: 100%;
  height: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.quiz-progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent-gold), #10b981);
  border-radius: 6px;
  transition: width 0.5s ease-out;
}

/* Quiz Arena Layout */
.quiz-arena-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 50px;
  width: 100%;
}

.quiz-card-container {
  width: 100%;
  max-width: 650px;
}

/* Override card grid styles for single card display */
.quiz-card-container .kiid-card {
  width: 100%;
  min-height: auto;
  box-shadow: var(--shadow-xl);
}

.quiz-navigation {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 650px;
  justify-content: space-between;
}

.quiz-nav-btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 50px;
  border: 2px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex: 1;
}

.quiz-nav-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quiz-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Quiz Number Selection Grid Map */
.quiz-map-container {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
}

.quiz-map-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.quiz-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 10px;
  justify-content: center;
}

.quiz-map-num {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  height: 42px;
  width: 42px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.quiz-map-num:hover {
  transform: scale(1.1);
  border-color: var(--accent-gold);
}

.quiz-map-num.active {
  border-color: var(--accent-gold);
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.quiz-map-num.answered-correct {
  background-color: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

.quiz-map-num.answered-incorrect {
  background-color: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Light/Dark theme specific enhancements */
body.light-theme .mode-btn.active {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

@media (max-width: 768px) {
  .kiid-mode-selector {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .mode-btn {
    width: 100%;
    max-width: 100%;
    padding: 12px 18px;
  }
  .quiz-dashboard {
    padding: 16px 20px;
    flex-direction: column;
    align-items: stretch;
  }
  .quiz-score-card {
    max-width: 100%;
  }
  .quiz-map-grid {
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 8px;
  }
  .quiz-map-num {
    height: 36px;
    width: 36px;
    font-size: 0.75rem;
  }
}

/* Circular Shuffle Icon Button next to Show More */
.btn-shuffle-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #f472b6 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-shuffle-icon:hover {
  transform: scale(1.1) rotate(20deg);
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.5);
}

.btn-shuffle-icon:active {
  transform: scale(0.95);
}

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

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

/* Custom Animated KiiD Mode Header & Innocent Investor Logo Sub-Header */
@keyframes bounceLetterI {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.anim-i {
  display: inline-block;
  animation: bounceLetterI 1.2s ease-in-out infinite;
  color: #fbbf24;
  -webkit-text-fill-color: #fbbf24 !important;
}

.anim-i:nth-of-type(2) {
  animation-delay: 0.2s;
  color: #f472b6;
  -webkit-text-fill-color: #f472b6 !important;
}

.by-author {
  font-size: 0.42em;
  font-weight: 600;
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  margin-left: 14px;
  letter-spacing: 0;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}

.by-author .logo {
  font-size: 15px !important;
  display: inline-block;
  vertical-align: middle;
  text-decoration: none;
}

/* Override the reels-title text-transform so ii remains small */
.reels-title {
  text-transform: none !important;
}

/* Adjust size inside mobile screens */
@media (max-width: 576px) {
  .by-author {
    display: block;
    margin-left: 0;
    margin-top: 6px;
    justify-content: center;
    font-size: 0.48em;
  }
}
