/* Anima Patient App - Serene Clinical Intelligence Design System */
@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 {
  /* Stitch Design System Tokens - Serene Purple Theme */
  --surface: #fbf8fe;
  --surface-dim: #ebdffc;
  --surface-bright: #faf7ff;
  --surface-container-lowest: #f6f1fe;
  --surface-container-low: #eee5fc;
  --surface-container: #e6dbfa;
  --surface-container-high: #ded0f7;
  --surface-container-highest: #d5c3f4;
  
  --on-surface: #131b2e;
  --on-surface-variant: #464555;
  --inverse-surface: #283044;
  --inverse-on-surface: #eef0ff;
  
  --primary: #3525cd;
  --primary-container: #4f46e5;
  --on-primary: #ffffff;
  --on-primary-container: #dad7ff;
  --primary-fixed: #e2dfff;
  --primary-fixed-dim: #c3c0ff;
  --on-primary-fixed: #0f0069;
  
  --secondary: #6b38d4;
  --secondary-container: #8455ef;
  --secondary-fixed: #e9ddff;
  --on-secondary-fixed: #23005c;
  --on-secondary: #ffffff;
  --on-secondary-container: #ffffff;
  
  --tertiary: #315100;
  --tertiary-container: #426b00;
  --tertiary-fixed: #acf847;
  --tertiary-fixed-dim: #91db2a;
  --on-tertiary-fixed: #102000;
  
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #93000a;
  
  --outline: #777587;
  --outline-variant: #c7c4d8;
  
  --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(--on-surface);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================================================================= */
/* 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: 
    radial-gradient(ellipse 95% 65% at 95% 0%, rgba(225, 198, 255, 0.85) 0%, rgba(241, 228, 255, 0.45) 45%, transparent 75%),
    radial-gradient(ellipse 70% 50% at 5% 100%, rgba(236, 219, 255, 0.6) 0%, rgba(247, 239, 255, 0.25) 35%, transparent 65%),
    linear-gradient(165deg, #fdfbff 0%, #f7f2fe 45%, #faf6ff 100%);
  background-color: #f7f2fe;
  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(253, 251, 255, 0.55);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border-bottom: 1px solid rgba(220, 210, 245, 0.5);
  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(--on-surface);
  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: transparent;
  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;
}

.dock-capsule {
  background: rgba(43, 30, 188, 0.82) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45) !important;
}

/* Home Indicator Bar */
.iphone-home-indicator {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.45);
  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;
    height: 100vh;
  }
  .iphone-frame {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* All Screens Grid Flow View (Multi-screen Gallery) */
.all-screens-view {
  width: 100%;
  max-width: 1600px;
  padding: 24px 16px 80px;
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 28px;
  justify-content: center;
}

.all-screens-view.active-view {
  display: grid;
}

.screen-card-frame {
  background: 
    radial-gradient(ellipse 95% 65% at 95% 0%, rgba(225, 198, 255, 0.85) 0%, rgba(241, 228, 255, 0.45) 45%, transparent 75%),
    radial-gradient(ellipse 70% 50% at 5% 100%, rgba(236, 219, 255, 0.6) 0%, rgba(247, 239, 255, 0.25) 35%, transparent 65%),
    linear-gradient(165deg, #fdfbff 0%, #f7f2fe 45%, #faf6ff 100%);
  background-color: #f7f2fe;
  border-radius: 32px;
  border: 6px solid #1e293b;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 780px;
  position: relative;
}

.screen-frame-header {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  display: none;
}

/* Glassmorphism & Micro-Neomorphic shadows */
.card-neomorph {
  background: linear-gradient(135deg, var(--surface-container-lowest) 0%, var(--surface-container-low) 100%);
  box-shadow: 0 8px 24px -4px rgba(79, 70, 229, 0.08), 0 2px 8px rgba(19, 27, 46, 0.04);
  border: 1px solid rgba(199, 196, 216, 0.7);
  padding: 1.5rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-neomorph:active {
  transform: scale(0.98);
}

.btn-primary-glow {
  background-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 10px 20px -4px rgba(79, 70, 229, 0.38);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary-glow:hover {
  background-color: var(--primary-container);
  box-shadow: 0 12px 24px -4px rgba(79, 70, 229, 0.48);
}

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

/* Voice Orb & Visualizer Animations */
.voice-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: 
    radial-gradient(circle at 50% 125%, rgba(172, 248, 71, 0.45) 0%, rgba(172, 248, 71, 0) 50%),
    radial-gradient(circle at 50% 25%, #6366f1 0%, #4338ca 45%, #3525cd 75%, #24169c 100%);
  box-shadow: 0 16px 36px -4px rgba(172, 248, 71, 0.5), 0 6px 20px rgba(53, 37, 205, 0.35);
  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(172, 248, 71, 0.75), 0 8px 30px rgba(79, 70, 229, 0.5);
}

.voice-orb.listening {
  animation: orb-pulse-listen 1.5s infinite ease-in-out;
  box-shadow: 0 18px 42px -2px rgba(172, 248, 71, 0.6), 0 8px 32px rgba(107, 56, 212, 0.5);
}

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

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

@keyframes orb-pulse-listen {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 14px 28px rgba(172, 248, 71, 0.35), 0 6px 25px rgba(79, 70, 229, 0.3);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 22px 52px rgba(172, 248, 71, 0.8), 0 8px 36px rgba(79, 70, 229, 0.6);
  }
}

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

.wave-bar {
  width: 4px;
  background-color: var(--primary);
  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; }
}

/* Bubble animation */
.bubble-enter {
  animation: slide-up-fade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 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 - Primary Color Theme */
.dock-capsule {
  background: linear-gradient(135deg, rgba(43, 30, 188, 0.88) 0%, rgba(53, 37, 205, 0.84) 50%, rgba(67, 56, 202, 0.82) 100%) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  box-shadow: 0 18px 40px -6px rgba(18, 10, 95, 0.65), 0 8px 18px -2px rgba(0, 0, 0, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

/* High-contrast visibility for all dock navigation items - Icon-Only Minimalist Dock */
.dock-capsule .nav-dock-item {
  color: #ffffff !important;
  opacity: 1 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.dock-capsule .nav-dock-item .nav-icon-wrap {
  width: 40px;
  height: 40px;
  color: #e0e7ff !important;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-capsule .nav-dock-item .nav-icon-wrap .material-symbols-outlined {
  color: #e0e7ff !important;
  font-size: 22px;
}

.dock-capsule .nav-dock-item .nav-label {
  display: none !important; /* Hide small text on toolbar as requested */
  color: #e0e7ff !important;
  font-size: 11px;
  font-weight: 600;
  transition: color 0.2s ease;
}

/* Hover state */
.dock-capsule .nav-dock-item:hover .nav-icon-wrap {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff !important;
  transform: translateY(-1px);
}

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

/* Active Tab State */
.dock-capsule .nav-dock-item.active .nav-icon-wrap {
  background: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 0 0 1.5px rgba(255, 255, 255, 0.5) !important;
}

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

.dock-voice-btn {
  background: radial-gradient(circle at 35% 35%, #d8ff85 0%, #acf847 60%, #85dc19 100%);
  box-shadow: 0 4px 18px rgba(172, 248, 71, 0.55), 0 0 12px rgba(172, 248, 71, 0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-voice-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(172, 248, 71, 0.75), 0 0 18px rgba(172, 248, 71, 0.45);
}

.dock-voice-btn:active {
  transform: scale(0.95);
}

.dock-voice-active {
  animation: dock-voice-pulse 1.8s infinite ease-in-out;
  box-shadow: 0 0 25px rgba(172, 248, 71, 0.9), 0 0 50px rgba(172, 248, 71, 0.5);
}

@keyframes dock-voice-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.15); }
}

/* Clinician Drawer Inspector */
.clinician-drawer {
  position: fixed;
  right: -440px;
  top: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #f4f6fe;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  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;
}

/* High Contrast UI Utilities for Clinical Badges & Controls */
.text-on-secondary {
  color: #ffffff !important;
}

.text-on-secondary-fixed {
  color: #23005c !important;
}

.bg-secondary-fixed {
  background-color: var(--secondary-fixed) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

/* ========================================================================= */
/* 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: var(--primary, #3525cd) !important;
}

/* ========================================================================= */
/* 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;
  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;
}

.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;
}

/* Corner Page Curl / Fold */
.natural-corner-curl {
  position: absolute;
  bottom: 0;
  width: 36px;
  height: 36px;
  pointer-events: none;
  z-index: 20;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.natural-corner-next {
  right: 0;
}
.natural-corner-next::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 24px 24px;
  border-color: transparent transparent #ded5c4 transparent;
  filter: drop-shadow(-2px -2px 3px rgba(0, 0, 0, 0.15));
  transition: all 0.25s ease;
  border-bottom-right-radius: 4px;
}
.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;
}
.natural-corner-prev::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 24px 24px 0;
  border-color: transparent transparent #ded5c4 transparent;
  filter: drop-shadow(2px -2px 3px rgba(0, 0, 0, 0.15));
  transition: all 0.25s ease;
  border-bottom-left-radius: 4px;
}
.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 (Active During Page Flip) */
/* ========================================================================= */
.notebook-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  perspective: 2500px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.notebook-page-container {
  width: calc(50% - 22px);
  height: 100%;
  position: relative;
}

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

/* 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; }
}
