/* Style Kustom Situs Pembelajaran Interaktif IPA - SRT 11 Rokan Hilir */
/* Catatan: @import Google Fonts sengaja TIDAK dipakai karena memblokir render.
   Font dimuat lewat <link rel="preconnect"> + <link rel="stylesheet"> di HTML.
   Lihat <head> pada index.html dan materi/01-organ-pernapasan/index.html. */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --secondary: #0d9488;
  --accent: #f59e0b;
  --oxygen: #38bdf8;
  --carbondioxide: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 50%, #f8fafc 100%);
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(226, 232, 240, 0.9);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  min-height: 100dvh;   /* lebih akurat di ponsel (address bar) */
  color: #1e293b;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Lexend', 'Plus Jakarta Sans', sans-serif;
}

/* Glass Card */
.glass-card {
  /* Fallback dulu untuk browser tanpa backdrop-filter */
  background: rgba(255, 255, 255, 0.92);
  background: var(--panel-bg);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

.glass-card {
  border: 1px solid var(--panel-border);
  border-radius: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  /* Dulu "transition: all" -> hanya properti yang benar-benar berubah (lebih hemat GPU) */
  transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.1);
}

/* IFP Touch Optimized Button */
.touch-btn {
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.touch-btn:active {
  transform: scale(0.97);
}

/* Hotspot Pins on Anatomy Image */
.hotspot-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.hotspot-pin {
  position: absolute;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  margin-top: -16px;
  border-radius: 50%;
  background: #0284c7;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.4), 0 4px 10px rgba(0, 0, 0, 0.25);
  animation: pulsePin 2.2s infinite;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s;
  z-index: 20;
}

.hotspot-pin:hover, .hotspot-pin.active {
  transform: scale(1.28);
  background: #f43f5e;
  box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.45), 0 6px 14px rgba(0, 0, 0, 0.3);
  z-index: 30;
}

@keyframes pulsePin {
  0% {
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(2, 132, 199, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
  }
}

/* Respiratory Breath Canvas Simulator */
#breathCanvas {
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  border-radius: 1.25rem;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Drag and Drop We Do Styles */
.drag-item {
  cursor: grab;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  touch-action: none;
}

.drag-item:active {
  cursor: grabbing;
}

.drag-item.dragging {
  opacity: 0.5;
  transform: scale(1.05);
}

.drop-slot {
  min-height: 64px;
  border: 2px dashed #94a3b8;
  border-radius: 1rem;
  background: rgba(241, 245, 249, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.drop-slot.drag-over {
  border-color: #0284c7;
  background: rgba(224, 242, 254, 0.85);
  transform: scale(1.02);
}

.drop-slot.filled-correct {
  border-color: #10b981;
  background: rgba(209, 250, 229, 0.9);
  border-style: solid;
}

.drop-slot.filled-wrong {
  border-color: #ef4444;
  background: rgba(254, 226, 226, 0.9);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Matching Card Flip */
.match-card {
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.match-card:hover {
  transform: translateY(-3px);
}

.match-card.selected {
  outline: 3px solid #0284c7;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.4);
}

.match-card.matched {
  outline: 3px solid #10b981;
  background: #ecfdf5;
  opacity: 0.75;
  pointer-events: none;
}

/* Quiz Option */
.quiz-opt {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.quiz-opt:hover:not(.disabled) {
  border-color: #0284c7;
  background-color: #f0f9ff;
  transform: translateX(4px);
}

.quiz-opt.correct {
  background-color: #d1fae5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}

.quiz-opt.wrong {
  background-color: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

/* Confetti Canvas overlay */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
  z-index: 9999;
}

/* ======================================================== */
/* POP-UP CERIA & NOTIFIKASI RAMAH ANAK (CERIAPOPUP)         */
/* ======================================================== */
.ceria-fade-in {
  animation: ceriaFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ceriaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ceria-pop-card {
  animation: ceriaPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ceriaPopIn {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(24px);
  }
  70% {
    opacity: 1;
    transform: scale(1.04) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ceria-mascot-wiggle {
  animation: ceriaMascotWiggle 2.5s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes ceriaMascotWiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-10deg) scale(1.08); }
  40% { transform: rotate(10deg) scale(1.08); }
  60% { transform: rotate(-6deg) scale(1.04); }
  80% { transform: rotate(6deg) scale(1.04); }
}

.ceria-sparkle {
  position: absolute;
  pointer-events: none;
  user-select: none;
  animation: ceriaSparkle 3s ease-in-out infinite alternate;
}

@keyframes ceriaSparkle {
  0% { transform: translateY(0) scale(0.85) rotate(0deg); opacity: 0.6; }
  50% { transform: translateY(-8px) scale(1.15) rotate(15deg); opacity: 1; }
  100% { transform: translateY(2px) scale(0.9) rotate(-10deg); opacity: 0.7; }
}

.ceria-toast-slide {
  animation: ceriaToastSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ============================================================
   Penampil 3D Organ (OrganViewer3D)
   ============================================================ */
.organ-3d-card {
  perspective: 1000px;
  perspective-origin: 50% 50%;
  overflow: hidden;
}

.organ-3d-shadow {
  transform: scale(1, 1);
  transition: transform 0.12s linear, opacity 0.2s linear;
  opacity: 0.5;
}

/* Bayangan ikut bergerak mengikuti kemiringan agar kesan 3D-nya kuat */
.organ-3d-card[data-tilt="kiri"] .organ-3d-shadow { transform: translateX(16px) scale(0.92, 1); }
.organ-3d-card[data-tilt="kanan"] .organ-3d-shadow { transform: translateX(-16px) scale(0.92, 1); }

/* Cegah gambar organ ikut bergeser saat digeser di layar sentuh */
.organ-3d-card img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@keyframes ceriaToastSlide {
  0% {
    opacity: 0;
    transform: translate(-50%, -40px) scale(0.85);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, 6px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* 3D Organ Viewer Canvas */
#organ3DStage {
  touch-action: none;
}

#organ3DCanvas {
  touch-action: none;
  display: block;
}

.organ-pill-btn {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.organ-pill-btn:hover {
  transform: translateY(-1.5px);
}

.organ-pill-btn:active {
  transform: scale(0.96);
}


/* Print styles for digital LKPD */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .no-print, header, nav, footer, #confettiCanvas, .tab-nav {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .glass-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    background: white !important;
    page-break-inside: avoid;
  }
}
