/* ==========================================================================
   TERAS SISWA - SDN SURYAKENCANA CBM KOTA SUKABUMI
   Slogan: "Ruang Santai Berbagi Karya dan Cerita"
   Styles & Animations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Caveat:wght@600;700&display=swap');

:root {
  --primary-orange: #f97316;
  --primary-orange-dark: #ea580c;
  --primary-orange-light: #fff7ed;
  --secondary-yellow: #f59e0b;
  --secondary-yellow-light: #fef3c7;
  --accent-cyan: #0284c7;
  --accent-cyan-light: #e0f2fe;
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;
  --accent-rose: #f43f5e;
  --accent-rose-light: #ffe4e6;
  --bg-sand: #fbfbf9;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --shadow-playful: 0 10px 25px -5px rgba(249, 115, 22, 0.12), 0 8px 10px -6px rgba(249, 115, 22, 0.08);
  --doodle-bg: #fafaf9;
  --doodle-dot: #cbd5e1;
}

html.dark {
  --doodle-bg: #0b0f19 !important;
  --doodle-dot: #1e293b !important;
  color-scheme: dark;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--doodle-bg) !important;
  color: var(--text-dark);
  overflow-x: hidden;
}

.font-heading {
  font-family: 'Fredoka', cursive, sans-serif;
}

.font-handwriting {
  font-family: 'Caveat', cursive;
}

/* Logo Sekolah Responsive Sizing */
.logo-sekolah-nav {
  width: 38px !important;
  height: 38px !important;
  max-width: 38px !important;
  max-height: 38px !important;
  object-fit: contain;
  display: block;
}

@media (min-width: 640px) {
  .logo-sekolah-nav {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
  }
}

@media (min-width: 768px) {
  .logo-sekolah-nav {
    width: 54px !important;
    height: 54px !important;
    max-width: 54px !important;
    max-height: 54px !important;
  }
}

/* Background pattern ceria */
.bg-doodle {
  background-color: var(--doodle-bg) !important;
  background-image: radial-gradient(var(--doodle-dot) 1px, transparent 1px), radial-gradient(var(--doodle-dot) 1px, var(--doodle-bg) 1px) !important;
  background-size: 30px 30px !important;
  background-position: 0 0, 15px 15px !important;
}

/* ==========================================================================
   THEME SYSTEM: DUAL MODE (CERAH & GELAP)
   ========================================================================== */
html.dark {
  color-scheme: dark;
}

/* --- TEMA GELAP (DARK MODE) --- */
html.dark body {
  background-color: #0b0f19 !important;
  color: #f1f5f9 !important;
}

html.dark .bg-doodle {
  background-color: #0b0f19 !important;
  background-image: radial-gradient(#1e293b 1px, transparent 1px), radial-gradient(#1e293b 1px, #0b0f19 1px) !important;
  background-size: 30px 30px !important;
  background-position: 0 0, 15px 15px !important;
}

html.dark header {
  background-color: rgba(15, 23, 42, 0.96) !important;
  border-color: #1e293b !important;
}

html.dark .card-playful,
html.dark article.karya-card,
html.dark aside > div,
html.dark #modal-upload > div > div,
html.dark #modal-reading > div > div {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
}

html.dark .card-playful:hover {
  border-color: #ea580c !important;
  box-shadow: 0 16px 30px -10px rgba(249, 115, 22, 0.25) !important;
}

html.dark footer {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
}

html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark textarea,
html.dark select {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

html.dark .reaction-btn {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html.dark .reaction-btn:hover {
  background-color: #334155 !important;
}

html.dark .reaction-btn.active {
  background-color: #431407 !important;
  border-color: #ea580c !important;
  color: #fdba74 !important;
}

html.dark .sticky-note {
  background-color: #1c1917 !important;
  border-color: #78350f !important;
  color: #fef3c7 !important;
}

html.dark .sticky-note::before {
  background: rgba(217, 119, 6, 0.7) !important;
}

html.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #f97316;
}

/* --- TEMA CERAH (LIGHT MODE) --- */
html:not(.dark) body {
  background-color: #fafaf9 !important;
  color: #1e293b !important;
}

html:not(.dark) .bg-doodle {
  background-color: #fafaf9 !important;
  background-image: radial-gradient(#cbd5e1 0.75px, transparent 0.75px), radial-gradient(#cbd5e1 0.75px, #fafaf9 0.75px) !important;
}

html:not(.dark) header {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-color: #ffedd5 !important;
}

html:not(.dark) .card-playful,
html:not(.dark) article.karya-card,
html:not(.dark) aside > div,
html:not(.dark) #modal-upload > div > div,
html:not(.dark) #modal-reading > div > div {
  background-color: #ffffff !important;
  border-color: #f1f5f9 !important;
}

html:not(.dark) footer {
  background-color: #ffffff !important;
  border-color: #ffedd5 !important;
}

/* Smooth Transitions for Theme Switching */
body, header, footer, aside > div, article.karya-card, input, textarea, select, #theme-toggle-btn {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* Custom Card & Shadows */
.card-playful {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1.5px solid #f1f5f9;
}

.card-playful:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 30px -10px rgba(249, 115, 22, 0.18);
  border-color: #fed7aa;
}

/* Reaction Button Interactive */
.reaction-btn {
  transition: all 0.2s ease;
  user-select: none;
}

.reaction-btn:hover {
  transform: scale(1.08);
}

.reaction-btn:active {
  transform: scale(0.92);
}

.reaction-btn.active {
  background-color: #ffedd5;
  border-color: #f97316;
  color: #ea580c;
  font-weight: 700;
}

/* Badge Glow */
.badge-verified {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.badge-p5 {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.badge-literasi {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.badge-eskul {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.badge-seni {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.badge-sains {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

/* Confetti Canvas Animation */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99999;
}

/* Carousel Animations */
.carousel-slide {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
  transform: scale(0.98);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.carousel-slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  position: relative;
}

/* Gamification Badge Bounce */
@keyframes pointPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.point-pulse {
  animation: pointPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Sticky notes style for sidebar quotes/ethical guidelines */
.sticky-note {
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.05);
  position: relative;
}

.sticky-note::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 45px;
  height: 14px;
  background: rgba(254, 240, 138, 0.7);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #f97316;
}

/* Filter Tab active state */
.filter-tab.active {
  background-color: #ea580c;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

/* Shaking animation for censored words */
@keyframes shakeWarning {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake-it {
  animation: shakeWarning 0.4s ease-in-out;
}
