/* ================================================================
   REKOLEKSI DIGITAL — STYLE.CSS
   File: src/css/style.css

   ISI FILE INI:
   01. Google Fonts & Reset
   02. CSS Variables (tema warna) ← edit di sini untuk ganti warna
   03. Background halaman
   04. Header
   05. Tombol kontrol
   06. Area mind map & layout
   07. Node (semua level)
   08. Animasi node muncul
   09. Modal gambar presentasi (slideshow)
   10. Mode presentasi (proyektor)
   11. Scrollbar
================================================================ */

/* ================================================================
   01. GOOGLE FONTS & RESET
================================================================ */
@import url("https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700&family=Space+Mono:wght@400;700&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ================================================================
   02. CSS VARIABLES (TEMA WARNA)
   Ganti nilai di sini untuk mengubah skema warna seluruh aplikasi.
================================================================ */
:root {
  /* Background */
  --bg-dark: #060b18;
  --bg-mid: #0d1428;

  /* Node Root (Level 0) — ungu */
  --node-root-bg: linear-gradient(135deg, #1a0a3c 0%, #0a1a4a 100%);
  --node-root-border: #7c3aed;
  --node-root-glow: rgba(124, 58, 237, 0.5);

  /* Node Level 1 — cyan */
  --node-l1-bg: linear-gradient(135deg, #062330 0%, #0a2040 100%);
  --node-l1-border: #06b6d4;
  --node-l1-glow: rgba(6, 182, 212, 0.45);

  /* Node Level 2 — hijau */
  --node-l2-bg: linear-gradient(135deg, #041a1a 0%, #073022 100%);
  --node-l2-border: #10b981;
  --node-l2-glow: rgba(16, 185, 129, 0.4);

  /* Node Level 3 — lime */
  --node-l3-bg: linear-gradient(135deg, #0c1a05 0%, #152b08 100%);
  --node-l3-border: #84cc16;
  --node-l3-glow: rgba(132, 204, 22, 0.4);

  /* Teks */
  --text-primary: #f0f4ff;
  --text-muted: #94a3b8;

  /* Font */
  --font-main: "Sora", sans-serif;
  --font-mono: "Space Mono", monospace;
}

/* ================================================================
   03. BACKGROUND HALAMAN
================================================================ */
body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
}

/* Grid halus dekoratif */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Aura radial */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 70% 50% at 30% 50%,
      rgba(124, 58, 237, 0.06) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 60% at 80% 30%,
      rgba(6, 182, 212, 0.05) 0%,
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
}

/* ================================================================
   04. HEADER
================================================================ */
#app-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 24px 20px 14px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.12);
  background: linear-gradient(
    180deg,
    rgba(6, 11, 24, 0.95) 0%,
    rgba(6, 11, 24, 0.7) 100%
  );
  backdrop-filter: blur(6px);
  transition: all 0.4s ease;
}

#app-header h1 {
  font-size: clamp(1.2rem, 2.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #7c3aed, #06b6d4, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#app-header h2 {
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

#app-header .hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(6, 182, 212, 0.6);
  margin-top: 10px;
  letter-spacing: 0.05em;
}

/* ================================================================
   05. TOMBOL KONTROL
================================================================ */
#controls {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  flex-wrap: wrap;
  transition: all 0.4s ease;
}

.ctrl-btn {
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
}
.ctrl-btn:hover {
  transform: translateY(-2px);
}

/* Reset — ungu */
#btn-reset {
  border-color: rgba(124, 58, 237, 0.6);
  color: #c4b5fd;
}
#btn-reset:hover {
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.3);
}

/* Tampilkan Semua — cyan */
#btn-show-all {
  border-color: rgba(6, 182, 212, 0.6);
  color: #67e8f9;
}
#btn-show-all:hover {
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.3);
}

/* Mode Presentasi — hijau */
#btn-present {
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
}
#btn-present:hover {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

/* ================================================================
   06. AREA MIND MAP & LAYOUT
================================================================ */
#mindmap-container {
  position: relative;
  z-index: 5;
  padding: 30px 40px 60px;
  min-height: calc(100vh - 160px);
  overflow-x: auto;
  overflow-y: visible;
}

.tree {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.node-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.node-group {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.children-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

/* ================================================================
   07. NODE (SEMUA LEVEL)
================================================================ */
.node {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  max-width: 220px;
  min-width: 120px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
  margin: 6px 0;
  user-select: none;
}
.node:hover {
  transform: translateY(-3px) scale(1.03);
}
.node.active {
  border-width: 1.5px;
}

/* Level 0 — Root (ungu) */
.node-0 {
  background: var(--node-root-bg);
  border-color: var(--node-root-border);
  box-shadow:
    0 0 16px var(--node-root-glow),
    0 4px 16px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  max-width: 240px;
  padding: 12px 18px;
}
.node-0:hover,
.node-0.active {
  box-shadow:
    0 0 28px rgba(124, 58, 237, 0.7),
    0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Level 1 — Cabang utama (cyan) */
.node-1 {
  background: var(--node-l1-bg);
  border-color: var(--node-l1-border);
  box-shadow:
    0 0 10px var(--node-l1-glow),
    0 2px 10px rgba(0, 0, 0, 0.4);
}
.node-1:hover,
.node-1.active {
  box-shadow:
    0 0 20px rgba(6, 182, 212, 0.65),
    0 4px 14px rgba(0, 0, 0, 0.5);
}

/* Level 2 — Subcabang (hijau) */
.node-2 {
  background: var(--node-l2-bg);
  border-color: var(--node-l2-border);
  box-shadow:
    0 0 8px var(--node-l2-glow),
    0 2px 8px rgba(0, 0, 0, 0.35);
  font-size: 0.73rem;
  max-width: 200px;
}
.node-2:hover,
.node-2.active {
  box-shadow:
    0 0 18px rgba(16, 185, 129, 0.6),
    0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Level 3 — Sub-subcabang (lime) */
.node-3 {
  background: var(--node-l3-bg);
  border-color: var(--node-l3-border);
  box-shadow:
    0 0 7px var(--node-l3-glow),
    0 2px 7px rgba(0, 0, 0, 0.3);
  font-size: 0.7rem;
  max-width: 180px;
}
.node-3:hover,
.node-3.active {
  box-shadow:
    0 0 16px rgba(132, 204, 22, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Simbol panah ▸ / ▾ */
.node-arrow {
  font-family: var(--font-mono);
  font-size: 0.75em;
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 4px;
  transition: opacity 0.2s;
}
.node:hover .node-arrow {
  opacity: 1;
}

/* Garis koneksi SVG */
.connector-svg {
  overflow: visible;
  flex-shrink: 0;
}

/* ================================================================
   08. ANIMASI NODE MUNCUL & TENTAKEL
================================================================ */
@keyframes nodeReveal {
  from {
    opacity: 0;
    transform: translateX(-18px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.node-animated {
  animation: nodeReveal 0.38s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

/* Tentakel tumbuh: stroke-dashoffset dari panjang penuh ke 0 */
@keyframes tentacleGrow {
  to {
    stroke-dashoffset: 0;
  }
}

/* Dot ujung tentakel muncul setelah garis selesai */
@keyframes tentacleDot {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================================================
   09. MODAL GAMBAR PRESENTASI (SLIDESHOW)
================================================================ */

/* Overlay gelap */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: modalFade 0.25s ease both;
}
#modal-overlay.open {
  display: flex;
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Kotak modal */
#modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 94vw;
  max-height: 95vh;
  animation: modalZoom 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

@keyframes modalZoom {
  from {
    transform: scale(0.88);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Tombol tutup */
#modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.5);
  background: rgba(13, 20, 40, 0.95);
  color: #67e8f9;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}
#modal-close:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: scale(1.1);
}

/* Header modal: judul + counter */
#modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  max-width: 84vw;
  flex-wrap: wrap;
}

#modal-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(6, 182, 212, 0.9);
  letter-spacing: 0.04em;
  text-align: center;
}

/* Counter "1 / 3" — hanya tampil jika banyak gambar */
#modal-counter {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  display: none;
}
#modal-counter.visible {
  display: inline;
}

/* Wrapper: tombol prev + gambar + tombol next */
#modal-slide-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Area gambar */
#modal-img-area {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow:
    0 0 40px rgba(124, 58, 237, 0.25),
    0 10px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 300px;
  min-height: 180px;
}

#modal-img {
  max-width: 80vw;
  max-height: 76vh;
  border-radius: 12px;
  object-fit: contain;
  display: block;
}

/* Animasi slide gambar */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
#modal-img.slide-right {
  animation: slideInRight 0.28s ease both;
}
#modal-img.slide-left {
  animation: slideInLeft 0.28s ease both;
}

/* Fallback jika gambar tidak ditemukan */
#modal-fallback {
  display: none;
  max-width: 70vw;
  min-width: 300px;
  min-height: 180px;
  border-radius: 12px;
  border: 1px dashed rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: center;
  padding: 40px 30px;
}
#modal-fallback .fallback-icon {
  font-size: 2rem;
  opacity: 0.5;
}
#modal-fallback .fallback-hint {
  margin-top: 4px;
  opacity: 0.55;
  font-size: 0.65rem;
}

/* Tombol Prev / Next */
.modal-nav-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.45);
  background: rgba(6, 11, 24, 0.85);
  color: #67e8f9;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  margin: 0 10px;
}
.modal-nav-btn:hover {
  background: rgba(6, 182, 212, 0.18);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
  transform: scale(1.1);
}
.modal-nav-btn:disabled {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}

/* Dots indikator slide */
#modal-dots {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
  min-height: 12px;
}
.modal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.22s ease;
  cursor: pointer;
}
.modal-dot.active {
  background: #06b6d4;
  box-shadow: 0 0 7px rgba(6, 182, 212, 0.8);
  transform: scale(1.35);
}

/* ================================================================
   10. MODE PRESENTASI (PROYEKTOR)
   Aktif saat tombol "Mode Presentasi" ditekan.
   Header mengecil, ruang mind map lebih luas.
================================================================ */
body.presentation-mode #app-header {
  padding: 10px 20px;
}
body.presentation-mode #app-header h1 {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
}
body.presentation-mode #app-header h2,
body.presentation-mode #app-header .hint {
  display: none;
}
body.presentation-mode #controls {
  padding: 6px 20px;
}
body.presentation-mode #mindmap-container {
  padding: 20px 30px 40px;
}

/* ================================================================
   11. SCROLLBAR
================================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.5);
}
