/* Anima Patient App - Version 2: Pastel Glassmorphic Medical Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  /* V2 Pastel Palette */
  --v2-bg: #f4f5f8;
  --v2-surface: #ffffff;
  --v2-mint: #e8f3ea;
  --v2-mint-border: #d4ebd8;
  --v2-mint-text: #1b4332;
  
  --v2-lavender: #efeaf8;
  --v2-lavender-border: #dfd5f3;
  --v2-lavender-text: #3c2a66;
  
  --v2-ice-blue: #e8f1fa;
  --v2-ice-border: #d0e4f7;
  --v2-ice-text: #1e3a8a;
  
  --v2-cream: #fbf5e6;
  --v2-cream-border: #f4e8c7;
  --v2-cream-text: #78350f;
  
  --v2-dark: #0f172a;
  --v2-slate: #334155;
  --v2-muted: #64748b;
  --v2-subtle: #94a3b8;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(ellipse at 50% 20%, #fbfaf7 0%, #ece8df 100%);
  background-color: #f3f1ea;
  color: var(--v2-dark);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Glassmorphism Classes */
.glass-btn {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.glass-btn:active {
  transform: scale(0.98);
}

.glass-pill {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.glass-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

/* ========================================================================= */
/* PROTOTYPE NAVIGATION SIDEBAR (Left Control Panel on Desktop) */
/* ========================================================================= */
.prototype-sidebar {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  width: 236px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 28px;
  padding: 14px;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
  color: #1e293b;
}

.prototype-sidebar::-webkit-scrollbar {
  display: none;
}

/* ========================================================================= */
/* DELUXE EDITORIAL NOTEBOOK (Designer Notes Trigger - Papier Journal Style) */
/* ========================================================================= */
.notebook-widget-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 14px 0;
}

.notebook-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.notebook-cover-trigger {
  position: relative;
  z-index: 2; /* Sits ON TOP of the ribbon bookmark */
  width: 152px;
  aspect-ratio: 1 / 1.34;
  background: linear-gradient(145deg, #f5f0e6 0%, #ece5da 45%, #e1d8cb 100%);
  border-radius: 3px 14px 14px 3px;
  box-shadow: 
    2px 3px 0 #d5cec0,
    3px 4px 0 #c7bfb0,
    0 12px 24px -6px rgba(15, 23, 42, 0.16),
    0 4px 10px -2px rgba(15, 23, 42, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: none;
  padding: 14px 12px 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notebook-container:hover .notebook-cover-trigger {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    2px 5px 0 #d5cec0,
    3px 6px 0 #c7bfb0,
    0 18px 30px -8px rgba(15, 23, 42, 0.2),
    0 6px 14px -3px rgba(15, 23, 42, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px 2px rgba(0, 0, 0, 0.06);
}

.notebook-container:active .notebook-cover-trigger {
  transform: translateY(-1px) scale(0.99);
  box-shadow: 
    1.5px 2px 0 #d5cec0,
    0 8px 16px -4px rgba(15, 23, 42, 0.15);
}

/* Spine on Left */
.notebook-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 10px;
  background: linear-gradient(to right, #cfc7b9 0%, #ded7ca 45%, #ece5da 80%, #cfc7b9 100%);
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
  box-shadow: inset 1.5px 0 2.5px rgba(0, 0, 0, 0.12);
  z-index: 3;
  pointer-events: none;
}

/* Book Hinge Crease Line */
.notebook-crease {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 13px;
  width: 1px;
  background: rgba(0, 0, 0, 0.07);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.65);
  z-index: 3;
  pointer-events: none;
}

/* Woven Sage Ribbon Bookmark - Tucked UNDERNEATH the book cover */
.notebook-ribbon {
  position: absolute;
  bottom: -15px;
  left: 26px;
  width: 14px;
  height: 24px;
  background: linear-gradient(180deg, #5a7b56 0%, #71936c 40%, #5a7b56 100%);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 1; /* Strictly UNDERNEATH the cover (which is z-index: 2) */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: top center;
  pointer-events: none;
}

.notebook-container:hover .notebook-ribbon {
  transform: rotate(-6deg) translateY(2px);
}

.notebook-serif-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  color: #1d3f84;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.prototype-pill {
  padding: 7px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.03);
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
}

.prototype-pill:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
  transform: translateX(2px);
}

.prototype-pill.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Shiny Neon Green Active State for UI Version and View Mode Switches */
.toggle-active-neon {
  background: #acf847 !important;
  color: #102000 !important;
  font-weight: 700 !important;
  border-color: #acf847 !important;
  box-shadow: 0 2px 10px rgba(172, 248, 71, 0.45) !important;
}

.toggle-active-neon span,
.toggle-active-neon {
  color: #102000 !important;
}

.toggle-active-neon .dot-indicator {
  background: #102000 !important;
}

/* View Mode: Phone Mode rules (Hide sidebar) */
body.mode-phone .prototype-sidebar {
  display: none !important;
}

/* Floating Switcher to return to Computer Mode on Desktop */
.floating-mode-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
}

/* On mobile phones & small screens (<= 960px), sidebar & floating button are ALWAYS hidden, and app fits screen */
@media (max-width: 960px) {
  .prototype-sidebar {
    display: none !important;
  }
  .floating-mode-switch {
    display: none !important;
  }
  .phone-mockup-wrapper {
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
  }
  .iphone-frame {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    aspect-ratio: auto !important;
    transform: none !important;
  }
}

/* ========================================================================= */
/* REALISTIC iPHONE 17 PRO PHONE FRAME (Desktop Mockup Enclosure) */
/* ========================================================================= */
.phone-mockup-wrapper {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.iphone-frame {
  width: 400px;
  height: 844px;
  max-width: 400px;
  max-height: 844px;
  aspect-ratio: 400 / 844; /* 1 : 2.11 - True Physical iPhone Aspect Ratio */
  flex-shrink: 0;
  transform-origin: center center;
  background-color: var(--v2-bg);
  border-radius: 54px;
  border: 11px solid #1c1d21;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 35px 80px -15px rgba(0, 0, 0, 0.22),
    0 15px 35px -8px rgba(0, 0, 0, 0.12),
    0 4px 12px -2px rgba(0, 0, 0, 0.06),
    inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

/* Unified Connected Frosted Top Bar (Status Bar + App Header) */
.iphone-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 98px;
  z-index: 45;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

/* Status Bar Row (44px) */
.iphone-status-bar {
  width: 100%;
  height: 44px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--v2-dark);
  letter-spacing: -0.02em;
  position: relative;
}

.iphone-status-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
}

.dynamic-island {
  width: 118px;
  height: 30px;
  background: #000000;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
}

.dynamic-island-sensor {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #08080c;
}

.dynamic-island-camera {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #24243a 0%, #050508 100%);
  border: 1px solid #1f1f2e;
}

.iphone-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* App Header Row (54px) inside connected top bar */
.iphone-app-header {
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* App Viewport Container (Scrollable Content inside iPhone Frame) */
.app-viewport {
  width: 100%;
  height: 100%;
  background-color: var(--v2-bg);
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 104px; /* Clearance for unified frosted top bar */
  padding-bottom: 96px; /* Clearance for fixed bottom dock */
  scrollbar-width: none;
}

.app-viewport::-webkit-scrollbar {
  display: none;
}

/* Fixed Bottom Dock Container (Anchored directly to iPhone Frame, NEVER scrolls!) */
.iphone-bottom-dock-container {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

/* Home Indicator Bar */
.iphone-home-indicator {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.35);
  z-index: 50;
  pointer-events: none;
}

/* In-Phone Native Modals (Confined strictly inside iPhone Screen, NEVER wider than phone) */
.in-phone-modal {
  position: absolute !important;
  inset: 0 !important;
  z-index: 55 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  border-radius: 43px !important;
  overflow: hidden !important;
}

.in-phone-modal.hidden {
  display: none !important;
}

.in-phone-modal > div {
  width: 100% !important;
  max-width: 100% !important;
  max-height: calc(100% - 24px) !important;
  overflow-y: auto !important;
  border-radius: 26px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
  animation: modal-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes modal-pop-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 480px) {
  .phone-mockup-wrapper {
    padding: 0;
  }
  .iphone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* Screen transition */
.app-screen {
  display: none !important;
  opacity: 0;
  transition: opacity 0.25s ease;
  flex-direction: column;
  width: 100%;
}

.app-screen.active {
  display: flex !important;
  opacity: 1;
}

/* Floating Bottom Capsule Dock - V2 Ultra-Translucent Frosted Glass with Solid Black Active Pill */
.dock-capsule-v2 {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28) 0%, rgba(245, 248, 255, 0.14) 100%) !important;
  backdrop-filter: blur(16px) saturate(190%) contrast(105%) brightness(105%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(190%) contrast(105%) brightness(105%) !important;
  box-shadow: 
    0 20px 45px -8px rgba(15, 23, 42, 0.12), 
    0 4px 14px rgba(15, 23, 42, 0.04),
    inset 0 1.5px 1.5px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: 9999px;
  padding: 6px 12px;
}

.dock-capsule-v2 .nav-dock-item {
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 9999px;
  padding: 4px;
}

.dock-capsule-v2 .nav-dock-item:hover {
  color: #0f172a;
}

.dock-capsule-v2 .nav-dock-item.active .nav-icon-wrap {
  background: #0f172a !important;
  color: #ffffff !important;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}

.dock-capsule-v2 .nav-dock-item.active .nav-icon-wrap .material-symbols-outlined {
  color: #ffffff !important;
}

.dock-capsule-v2 .nav-dock-item .nav-label {
  display: none; /* Icon-only minimalist dock matching the mockup */
}



/* Sound wave animation */
.soundwave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
}

.wave-bar {
  width: 4px;
  background-color: #4f46e5;
  border-radius: 9999px;
  height: 8px;
  transition: height 0.15s ease;
}

.wave-active .wave-bar:nth-child(1) { animation: wave-jump 1.1s infinite 0.1s ease-in-out; }
.wave-active .wave-bar:nth-child(2) { animation: wave-jump 1.1s infinite 0.3s ease-in-out; }
.wave-active .wave-bar:nth-child(3) { animation: wave-jump 1.1s infinite 0.5s ease-in-out; }
.wave-active .wave-bar:nth-child(4) { animation: wave-jump 1.1s infinite 0.2s ease-in-out; }
.wave-active .wave-bar:nth-child(5) { animation: wave-jump 1.1s infinite 0.4s ease-in-out; }
.wave-active .wave-bar:nth-child(6) { animation: wave-jump 1.1s infinite 0.15s ease-in-out; }
.wave-active .wave-bar:nth-child(7) { animation: wave-jump 1.1s infinite 0.35s ease-in-out; }

@keyframes wave-jump {
  0%, 100% { height: 6px; }
  50% { height: 28px; }
}

/* Voice Orb */
.voice-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 25%, #818cf8 0%, #4f46e5 50%, #312e81 100%);
  box-shadow: 0 16px 36px -4px rgba(79, 70, 229, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: orb-breathe 4s infinite ease-in-out;
}

.voice-orb.speaking {
  animation: orb-pulse-active 1.2s infinite ease-in-out;
  box-shadow: 0 20px 48px -2px rgba(16, 185, 129, 0.6);
}

.voice-orb.listening {
  animation: orb-pulse-listen 1.5s infinite ease-in-out;
  box-shadow: 0 18px 42px -2px rgba(99, 102, 241, 0.6);
}

@keyframes orb-breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.05); }
}

@keyframes orb-pulse-active {
  0%, 100% { transform: scale(1.02); }
  50% { transform: scale(1.12); }
}

@keyframes orb-pulse-listen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Clinician Drawer Inspector */
.clinician-drawer {
  position: fixed;
  right: -440px;
  top: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #f8fafc;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  padding: 28px;
}

.clinician-drawer.open {
  right: 0;
}

/* V2 Primary Pill Button matching Mockup */
.btn-primary-glow {
  background: #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25) !important;
  border: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-primary-glow:hover {
  background: #1e293b !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -4px rgba(15, 23, 42, 0.3) !important;
}

.btn-primary-glow:active {
  transform: scale(0.98);
}

/* V2 Master Card Styling */
.card-neomorph {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.04);
}

/* ========================================================================= */
/* DOCTOR CAROUSEL: HIDE OLD-FASHIONED SCROLLBAR & STYLE ELEGANT DOTS       */
/* ========================================================================= */
.scrollbar-none::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar,
#doctor-carousel-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.scrollbar-none,
.no-scrollbar,
#doctor-carousel-container {
  -ms-overflow-style: none !important;  /* IE and Edge */
  scrollbar-width: none !important;  /* Firefox */
}

.carousel-dot {
  cursor: pointer;
  padding: 0;
  border: none;
  outline: none;
  background-color: #cbd5e1;
  border-radius: 9999px;
  height: 6px;
  width: 6px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.carousel-dot::after {
  content: '';
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -4px;
  right: -4px;
}

.carousel-dot:hover {
  background-color: #94a3b8;
}

.carousel-dot.active {
  width: 20px;
  background-color: #0f172a !important; /* V2 Sleek Black Brand Pill */
}

/* ========================================================================= */
/* OPEN NOTEBOOK MODAL (Two-Page Spread with Spiral Binding & 3D Animation) */
/* ========================================================================= */
.open-notebook-shell {
  width: 980px;
  height: 660px;
  max-width: 980px;
  max-height: 660px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #f5f0e6 0%, #ece5da 45%, #ded5c5 100%);
  border-radius: 26px;
  box-shadow: 
    0 35px 80px -15px rgba(0, 0, 0, 0.45), 
    0 15px 35px -5px rgba(0, 0, 0, 0.22),
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.95),
    inset 0 -2px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.12);
  transform: scale(var(--notebook-scale, 1));
  transform-origin: center center;
}

#designer-notes-modal.modal-opening .open-notebook-shell {
  animation: openNotebookSpread 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#designer-notes-modal.modal-closing .open-notebook-shell {
  animation: closeNotebookSpread 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes openNotebookSpread {
  0% {
    opacity: 0;
    transform: scale(calc(var(--notebook-scale, 1) * 0.68)) rotateX(12deg) translateY(30px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: scale(var(--notebook-scale, 1)) rotateX(0deg) translateY(0);
    filter: blur(0);
  }
}

@keyframes closeNotebookSpread {
  0% {
    opacity: 1;
    transform: scale(var(--notebook-scale, 1)) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(calc(var(--notebook-scale, 1) * 0.72)) translateY(20px);
  }
}

.notebook-left-page {
  background: linear-gradient(to right, #fbf7ee 0%, #fefcf7 85%, #f4eee1 100%);
  border-radius: 14px 4px 4px 14px;
  box-shadow: 
    -2px 0 0 #eae3d2,
    -4px 0 0 #ded6c2,
    -1px 2px 10px rgba(0, 0, 0, 0.1);
  transform-origin: right center;
}

#designer-notes-modal.modal-opening .base-page-left {
  animation: leftPageFlipOpen 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes leftPageFlipOpen {
  0% {
    transform: perspective(1400px) rotateY(-25deg);
    opacity: 0.6;
  }
  100% {
    transform: perspective(1400px) rotateY(0deg);
    opacity: 1;
  }
}

.notebook-right-page {
  background: linear-gradient(to left, #fbf7ee 0%, #fefcf7 85%, #f4eee1 100%);
  border-radius: 4px 14px 14px 4px;
  box-shadow: 
    2px 0 0 #eae3d2,
    4px 0 0 #ded6c2,
    1px 2px 10px rgba(0, 0, 0, 0.1);
  transform-origin: left center;
}

#designer-notes-modal.modal-opening .base-page-right {
  animation: rightPageFlipOpen 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rightPageFlipOpen {
  0% {
    transform: perspective(1400px) rotateY(25deg);
    opacity: 0.6;
  }
  100% {
    transform: perspective(1400px) rotateY(0deg);
    opacity: 1;
  }
}

.notebook-spiral-spine {
  width: 44px;
  background: linear-gradient(to right, #ded5c5 0%, #ece5da 50%, #ded5c5 100%);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.08);
}

.notebook-page-scroll::-webkit-scrollbar {
  width: 5px;
}
.notebook-page-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.notebook-page-scroll::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 9999px;
}
.notebook-page-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.4);
}

/* Real Highlighter Pen Style */
.real-highlighter {
  background: linear-gradient(104deg, rgba(254, 240, 138, 0.15) 0.5%, rgba(254, 240, 138, 0.88) 2%, rgba(253, 224, 71, 0.82) 96%, rgba(254, 240, 138, 0.15) 99.5%);
  padding: 2px 6px 1px 6px;
  border-radius: 2px 4px 3px 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: #0f172a;
  font-weight: 500;
  display: inline;
}

/* Natural Notebook Dog-Ear Corners (Authentic Origami Paper Fold) */
.natural-corner-curl {
  position: absolute;
  bottom: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  user-select: none;
  z-index: 10;
}
.natural-corner-next {
  right: 0;
  justify-content: flex-end;
  border-bottom-right-radius: 14px;
}
.natural-corner-next::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 22px 22px;
  border-color: transparent transparent #ded5c5 transparent;
  border-bottom-right-radius: 14px;
  filter: drop-shadow(-2px -2px 3px rgba(0, 0, 0, 0.15));
  transition: all 0.25s ease;
}
.notebook-clickable-page:hover .natural-corner-next::before {
  border-width: 0 0 30px 30px;
  border-color: transparent transparent #d5cbba transparent;
  filter: drop-shadow(-3px -3px 5px rgba(29, 63, 132, 0.25));
}

.natural-corner-prev {
  left: 0;
  justify-content: flex-start;
  border-bottom-left-radius: 14px;
}
.natural-corner-prev::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent transparent #ded5c5 transparent;
  border-bottom-left-radius: 14px;
  filter: drop-shadow(2px -2px 3px rgba(0, 0, 0, 0.15));
  transition: all 0.25s ease;
}
.notebook-clickable-page:hover .natural-corner-prev::before {
  border-width: 0 30px 30px 0;
  border-color: transparent transparent #d5cbba transparent;
  filter: drop-shadow(3px -3px 5px rgba(29, 63, 132, 0.25));
}

/* ========================================================================= */
/* THE REAL PHYSICAL 3D TURNING LEAF (Single Leaf Hinged at Centerline) */
/* ========================================================================= */
.notebook-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  perspective: 2500px;
  transform-style: preserve-3d;
}

/* Base Left Page (Page 01) - Static */
.base-page-left {
  width: calc(50% - 22px);
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Spiral Spine - Center (width 44px) */
.notebook-spiral-spine {
  width: 44px;
  height: 100%;
  background: linear-gradient(to right, #ded5c5 0%, #ece5da 50%, #ded5c5 100%);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 30;
}

/* Base Right Page (Page 04) - Static */
.base-page-right {
  width: calc(50% - 22px);
  height: 100%;
  position: relative;
  z-index: 1;
}

/* ======================================================== */
/* THE SINGLE PHYSICAL FLIPPING LEAF (ONLY THIS SHEET FLIPS) */
/* ======================================================== */
.flipping-leaf,
.flipper-leaf {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 25;
  cursor: pointer;
  user-select: none;
}

/* The actual paper sheet mounted inside the flipper */
.flipping-sheet,
.flipper-sheet {
  position: absolute;
  top: 0;
  left: 22px;
  width: calc(100% - 22px);
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

/* Each face of the paper sheet */
.flip-face,
.flipper-face {
  position: absolute !important;
  inset: 0 !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  transform-origin: center center !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Front face: Page 02 */
.flip-front,
.flipper-front {
  background: linear-gradient(to left, #fbf7ee 0%, #fefcf7 85%, #f4eee1 100%);
  border-radius: 4px 14px 14px 4px;
  box-shadow: 2px 0 0 #eae3d2, 4px 0 0 #ded6c2, 1px 2px 10px rgba(0, 0, 0, 0.08);
  transform: rotateY(0deg) !important;
  z-index: 2;
}

/* Back face: Page 03 */
.flip-back,
.flipper-back {
  background: linear-gradient(to right, #fbf7ee 0%, #fefcf7 85%, #f4eee1 100%);
  border-radius: 14px 4px 4px 14px;
  box-shadow: -2px 0 0 #eae3d2, -4px 0 0 #ded6c2, 1px 2px 10px rgba(0, 0, 0, 0.08);
  transform: rotateY(180deg) !important;
  z-index: 2;
}

/* Landed States */
.turned-right {
  transform: rotateY(0deg) !important;
}
.turned-left {
  transform: rotateY(-180deg) !important;
}

/* Ensure both faces remain rendered in the 3D space */
.flipper-leaf .flipper-front,
.flipper-leaf .flipper-back {
  display: flex !important;
}

/* Turning Forward Animation */
.turn-forward {
  animation: flipLeafForward 0.68s cubic-bezier(0.28, 0.1, 0.25, 1) forwards;
}

@keyframes flipLeafForward {
  0% {
    transform: perspective(2500px) rotateY(0deg);
  }
  25% {
    /* Bottom corner lifts with natural paper curl */
    transform: perspective(2500px) rotateY(-32deg) rotateZ(-2deg) skewY(-1.5deg);
  }
  50% {
    /* Edge-on over spiral spine */
    transform: perspective(2500px) rotateY(-90deg) rotateZ(-3.2deg) skewY(-2deg) translateZ(16px);
  }
  75% {
    /* Decelerating onto left page */
    transform: perspective(2500px) rotateY(-148deg) rotateZ(-1.5deg) skewY(-1deg) translateZ(8px);
  }
  100% {
    /* Land flat on left */
    transform: perspective(2500px) rotateY(-180deg) rotateZ(0deg) skewY(0deg) translateZ(0);
  }
}

/* Turning Backward Animation */
.turn-backward {
  animation: flipLeafBackward 0.68s cubic-bezier(0.28, 0.1, 0.25, 1) forwards;
}

@keyframes flipLeafBackward {
  0% {
    transform: perspective(2500px) rotateY(-180deg);
  }
  25% {
    /* Bottom corner lifts with natural paper curl */
    transform: perspective(2500px) rotateY(-148deg) rotateZ(2deg) skewY(1.5deg);
  }
  50% {
    /* Edge-on over spiral spine */
    transform: perspective(2500px) rotateY(-90deg) rotateZ(3.2deg) skewY(2deg) translateZ(16px);
  }
  75% {
    /* Decelerating onto right page */
    transform: perspective(2500px) rotateY(-32deg) rotateZ(1.5deg) skewY(1deg) translateZ(8px);
  }
  100% {
    /* Land flat on right */
    transform: perspective(2500px) rotateY(0deg) rotateZ(0deg) skewY(0deg) translateZ(0);
  }
}

/* Backwards-compatible keyframe aliases */
@keyframes turnPageOutRight { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(-90deg); } }
@keyframes turnPageInLeft { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0deg); } }
@keyframes turnPageOutLeft { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(90deg); } }
@keyframes turnPageInRight { 0% { transform: rotateY(-90deg); } 100% { transform: rotateY(0deg); } }

/* Mobile Responsiveness for Notebook */
@media (max-width: 767px) {
  .open-notebook-shell {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    transform: none !important;
  }
  .notebook-stage {
    flex-direction: column;
    overflow-y: auto;
    perspective: none;
    transform-style: flat;
  }
  .notebook-page-container {
    width: 100% !important;
    height: auto !important;
  }
  .base-page-left,
  .base-page-right,
  .notebook-left-page,
  .notebook-right-page {
    width: 100% !important;
    height: auto !important;
    min-height: auto;
    border-radius: 14px !important;
    position: static !important;
  }
  .notebook-spiral-spine {
    display: none !important;
  }
  .flipping-leaf,
  .flipper-leaf {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    animation: none !important;
  }
  .flipping-sheet,
  .flipper-sheet {
    position: static !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
  }
  .flip-face,
  .flipper-face {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    border-radius: 14px !important;
  }

  /* Spread 1 on mobile: Page 1 and Page 2 visible, Page 3 and Page 4 hidden */
  .notebook-stage.spread-1 .base-page-left { display: flex !important; }
  .notebook-stage.spread-1 .flipper-front { display: flex !important; }
  .notebook-stage.spread-1 .flipper-back { display: none !important; }
  .notebook-stage.spread-1 .base-page-right { display: none !important; }

  /* Spread 2 on mobile: Page 3 and Page 4 visible, Page 1 and Page 2 hidden */
  .notebook-stage.spread-2 .base-page-left { display: none !important; }
  .notebook-stage.spread-2 .flipper-front { display: none !important; }
  .notebook-stage.spread-2 .flipper-back { display: flex !important; }
  .notebook-stage.spread-2 .base-page-right { display: flex !important; }
}

/* Hand-drawn arrow animation */
.handwritten-arrow {
  stroke-dasharray: 40;
  stroke-dashoffset: 0;
  animation: drawArrow 1.2s ease-out forwards;
}
@keyframes drawArrow {
  from { stroke-dashoffset: 40; }
  to { stroke-dashoffset: 0; }
}

