@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #FAFAF8;
  --bg-warm: #FFF8F0;
  --text: #1A1A2E;
  --text-light: #555;
  --green: #2D6A4F;
  --green-light: #40916C;
  --orange: #E76F51;
  --coral: #F4845F;
  --yellow: #F7DC6F;
  --blue: #457B9D;
  --teal: #2A9D8F;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Progress Bar */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--green), var(--teal));
  transition: width 0.4s ease; z-index: 100;
}

/* Slide Container */
.deck { position: relative; width: 100vw; height: 100vh; }

.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 80px 140px;
  opacity: 0; transform: translateX(60px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  text-align: center;
}
.slide.active {
  opacity: 1; transform: translateX(0);
  pointer-events: auto;
}
.slide.prev {
  opacity: 0; transform: translateX(-60px);
}

/* Slide Visual Area */
.slide-visual {
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%; max-height: 55vh;
}
.slide-visual img {
  max-height: 100%; max-width: 80%; object-fit: contain;
  border-radius: var(--radius);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.08));
}
.slide-visual .emoji-hero {
  font-size: clamp(120px, 18vw, 280px); line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Typography */
.slide h1 {
  font-size: clamp(2rem, 4.5vw, 5rem); font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: clamp(8px, 1.2vw, 20px); line-height: 1.2;
}
.slide h2 {
  font-size: clamp(1.5rem, 3vw, 3.5rem); font-weight: 700; color: var(--text);
  margin-bottom: clamp(6px, 0.8vw, 16px);
}
.slide h3 {
  font-size: clamp(1rem, 1.8vw, 2.2rem); font-weight: 400; color: var(--text-light);
  max-width: 900px; line-height: 1.6;
}
.slide .tag {
  display: inline-block; padding: clamp(4px, 0.6vw, 10px) clamp(12px, 1.5vw, 24px); border-radius: 50px;
  font-size: clamp(0.75rem, 1.2vw, 1.4rem); font-weight: 600; margin: 6px 4px;
}
.tag-green { background: #D8F3DC; color: var(--green); }
.tag-orange { background: #FFE8D6; color: var(--orange); }
.tag-blue { background: #D4E8F0; color: var(--blue); }

/* Section Title Slides */
.slide.section-slide {
  background: linear-gradient(135deg, var(--green) 0%, var(--teal) 100%);
}
.slide.section-slide h1 {
  color: #fff; -webkit-text-fill-color: #fff;
  background: none; font-size: clamp(2.5rem, 5vw, 6rem);
}
.slide.section-slide h3 { color: rgba(255,255,255,0.8); }
.slide.section-slide .section-num {
  font-size: clamp(4rem, 8vw, 12rem); font-weight: 800; color: rgba(255,255,255,0.15);
  position: absolute; top: 40px; right: 60px;
}

/* Cards Grid */
.cards { display: flex; gap: clamp(14px, 2vw, 32px); flex-wrap: wrap; justify-content: center; }
.card {
  background: #fff; border-radius: var(--radius);
  padding: clamp(20px, 2.5vw, 40px) clamp(16px, 2vw, 32px); min-width: clamp(160px, 18vw, 300px); flex: 1; max-width: clamp(240px, 22vw, 380px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border-top: 4px solid var(--green);
  transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-4px); }
.card .card-icon { font-size: clamp(2rem, 3.5vw, 5rem); margin-bottom: clamp(8px, 1vw, 18px); }
.card .card-title { font-weight: 700; font-size: clamp(0.95rem, 1.4vw, 1.8rem); margin-bottom: clamp(4px, 0.5vw, 10px); }
.card .card-text { font-size: clamp(0.78rem, 1.1vw, 1.4rem); color: var(--text-light); line-height: 1.5; }
.card.orange-top { border-top-color: var(--orange); }
.card.blue-top { border-top-color: var(--blue); }

/* Five Systems */
.systems { display: flex; gap: clamp(10px, 1.5vw, 24px); flex-wrap: wrap; justify-content: center; }
.system-item {
  background: #fff; border-radius: 12px; padding: clamp(12px, 1.5vw, 24px) clamp(10px, 1.2vw, 20px);
  width: clamp(110px, 13vw, 200px); text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}
.system-item:hover { transform: scale(1.05); }
.system-item .sys-icon { font-size: clamp(1.8rem, 3vw, 4.5rem); margin-bottom: clamp(6px, 0.8vw, 14px); }
.system-item .sys-name { font-size: clamp(0.72rem, 1.1vw, 1.4rem); font-weight: 600; }

/* Quote */
.quote {
  font-size: clamp(1.1rem, 2vw, 2.4rem); font-style: italic; font-weight: 300;
  max-width: 900px; line-height: 1.8; color: var(--text);
  position: relative; padding: 0 clamp(24px, 4vw, 60px);
}
.quote::before, .quote::after {
  content: '"'; font-size: clamp(3rem, 5vw, 7rem); color: var(--green);
  opacity: 0.2; position: absolute; font-style: normal;
  font-weight: 800; line-height: 1;
}
.quote::before { top: -10px; left: 0; }
.quote::after { bottom: -30px; right: 0; content: '"'; }

/* Diagram: Insulin Lock */
.diagram {
  display: flex; align-items: center; gap: clamp(16px, 2.5vw, 40px);
  background: #fff; border-radius: var(--radius);
  padding: clamp(20px, 3vw, 48px); box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.diagram-step {
  text-align: center; flex: 1;
}
.diagram-step .step-icon { font-size: clamp(2rem, 3.5vw, 5rem); margin-bottom: clamp(6px, 0.8vw, 14px); }
.diagram-step .step-text { font-size: clamp(0.78rem, 1.2vw, 1.6rem); font-weight: 500; }
.diagram-arrow { font-size: clamp(1.2rem, 2vw, 2.8rem); color: var(--orange); }

/* Footer */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #eee;
  z-index: 50; transition: height 0.3s ease;
}
.footer-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; height: 50px;
}
.nav-buttons { display: flex; align-items: center; gap: 12px; }
.nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #ddd; background: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text);
  transition: all 0.2s ease;
}
.nav-btn:hover { border-color: var(--green); color: var(--green); }
.slide-counter { font-size: 0.85rem; color: var(--text-light); font-weight: 500; }

/* Notes Toggle */
.notes-toggle {
  display: none !important;
}
.toggle-switch {
  width: 40px; height: 22px; border-radius: 11px;
  background: #ddd; cursor: pointer; position: relative;
  transition: background 0.3s ease;
}
.toggle-switch.on { background: var(--green); }
.toggle-switch .toggle-knob {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px; left: 2px;
  transition: left 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on .toggle-knob { left: 20px; }

/* Notes Panel */
.notes-panel {
  display: none !important;
}
.notes-panel.open {
  max-height: 200px; padding: 16px 24px;
}
.notes-panel p {
  font-size: 0.82rem; color: var(--text-light);
  line-height: 1.7; max-width: 900px;
}

/* Fullscreen button */
.fs-btn {
  background: none; border: 1px solid #ddd; border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 0.85rem;
  color: var(--text-light); transition: all 0.2s ease;
}
.fs-btn:hover { border-color: var(--green); color: var(--green); }

/* Responsive */
@media (max-width: 768px) {
  .slide { padding: 40px 24px 130px; }
  .slide h1 { font-size: 2rem; }
  .slide h2 { font-size: 1.4rem; }
  .slide h3 { font-size: 1rem; }
  .cards { flex-direction: column; align-items: center; }
  .card { max-width: 100%; }
  .systems { gap: 8px; }
  .system-item { width: 100px; padding: 10px 8px; }
  .diagram { flex-direction: column; gap: 12px; }
  .diagram-arrow { transform: rotate(90deg); }
  .quote { font-size: 1.1rem; padding: 0 20px; }
}


/* Language Toggle */
html[lang="en"] .lang-vi { display: none !important; }
html[lang="vi"] .lang-en { display: none !important; }

/* Book Links Component */
.book-links {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 24px);
  width: 100%;
  max-width: clamp(420px, 55vw, 780px);
  margin: clamp(20px, 2.5vw, 48px) auto 0;
}
.book-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 1);
  padding: clamp(12px, 1.5vw, 24px) clamp(16px, 2vw, 36px);
  border-radius: clamp(12px, 1.5vw, 20px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.book-link-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}
.book-info {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 20px);
  text-align: left;
}
.book-icon {
  font-size: clamp(1.5rem, 2.5vw, 3.5rem);
}
.book-name {
  font-weight: 700;
  font-size: clamp(0.9rem, 1.4vw, 1.8rem);
  color: var(--text);
  line-height: 1.2;
}
.book-author {
  font-size: clamp(0.7rem, 1vw, 1.3rem);
  color: var(--text-light);
  font-weight: 400;
  display: block;
  margin-top: 2px;
}
.cta-read {
  padding: clamp(8px, 1vw, 16px) clamp(14px, 1.8vw, 28px);
  border-radius: clamp(8px, 1vw, 14px);
  font-size: clamp(0.75rem, 1.1vw, 1.4rem);
  font-weight: 700;
  color: #fff;
  background: var(--green);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.2);
  white-space: nowrap;
  transition: background 0.2s ease;
}
.book-link-item:hover .cta-read {
  background: var(--green-light);
}
.cta-orange-bg .cta-read {
  background: var(--orange);
  box-shadow: 0 4px 12px rgba(231, 111, 81, 0.2);
}
.cta-orange-bg:hover .cta-read {
  background: var(--coral);
}
