/* ==========================================================================
   Dr. Juey-Jen Hwang (黃瑞仁 院長/教授) Official Medical Portfolio & Portal
   Custom Responsive Styling & Animations
   TailwindCSS + Custom Medical UI Tokens
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Noto+Sans+TC:wght@400;500;700;900&family=Noto+Serif+TC:wght@600;700;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #005f73;
  --primary-dark: #0a2540;
  --primary-light: #e8f4f8;
  --primary-hover: #0a9396;
  
  --accent: #028090;
  --accent-cyan: #00b4d8;
  --accent-gold: #e9d8a6;
  --accent-warm: #ca6702;
  --accent-red: #e63946;
  --success: #2a9d8f;
  
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-dark: #0b192c;
  --bg-dark-card: #13243c;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --text-white: #ffffff;
  
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #028090;
  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 24px 38px -6px rgba(15, 23, 42, 0.16);
  --shadow-glow: 0 0 25px rgba(0, 180, 216, 0.35);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* Scroll offset for sticky headers */
section[id],
#family-book {
  scroll-margin-top: 110px;
}

body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans TC', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-body);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #005f73;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #005f73;
}

/* Glassmorphism Classes */
.glass-nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-nav.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.1);
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 35px -10px rgba(0, 95, 115, 0.12);
  border-color: rgba(10, 147, 150, 0.4);
}

.glass-dark-card {
  background: rgba(19, 36, 60, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.3);
}

/* Heartbeat ECG Animations */
@keyframes heartPulse {
  0% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.18); }
  70% { transform: scale(1); }
  100% { transform: scale(1); }
}

.animate-heart-pulse {
  animation: heartPulse 1.8s infinite ease-in-out;
  display: inline-block;
  transform-origin: center;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.6);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(230, 57, 70, 0);
  }
}

.pulse-dot-red {
  width: 10px;
  height: 10px;
  background-color: var(--accent-red);
  border-radius: 50%;
  display: inline-block;
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGreen {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(42, 157, 143, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(42, 157, 143, 0);
  }
}

.pulse-dot-green {
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulseGreen 1.8s infinite;
}

/* Medical Gradient Backgrounds */
.bg-medical-gradient {
  background: linear-gradient(135deg, #0a2540 0%, #005f73 50%, #0a9396 100%);
}

.bg-medical-subtle {
  background: radial-gradient(circle at 80% 20%, rgba(0, 180, 216, 0.08) 0%, rgba(248, 250, 252, 1) 70%);
}

.text-gradient {
  background: linear-gradient(135deg, #005f73 0%, #0a9396 60%, #00b4d8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Video Card Styling */
.video-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.video-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 30px -10px rgba(10, 37, 64, 0.15);
  border-color: #0a9396;
}

.video-thumb-container {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background-color: #0f172a;
}

.video-thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.video-card:hover .video-thumb-container img {
  transform: scale(1.06);
}

.play-badge-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 37, 64, 0.35);
  opacity: 0.9;
  transition: all 0.3s ease;
}

.play-icon-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #e63946;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.video-card:hover .play-icon-circle {
  transform: scale(1.15);
  background: #e63946;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(230, 57, 70, 0.5);
}

/* Photo Gallery Item */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
  background-color: #0f172a;
}

.gallery-item img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 37, 64, 0.92) 0%, rgba(10, 37, 64, 0.4) 60%, transparent 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  color: #ffffff;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 47, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #ffffff;
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

.lightbox-img-wrapper {
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0b192c;
}

.lightbox-img-wrapper img {
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
}

/* Category Filter Buttons */
.filter-btn {
  padding: 0.55rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: #005f73;
  color: #005f73;
  background: #f1f5f9;
}

.filter-btn.active {
  background: #005f73;
  color: #ffffff;
  border-color: #005f73;
  box-shadow: 0 4px 12px rgba(0, 95, 115, 0.25);
}

/* CT Comparison Slider / Card */
.ct-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.ct-card:hover {
  border-color: #0a9396;
  box-shadow: 0 10px 25px rgba(10, 147, 150, 0.15);
}

/* Floating Badges */
.badge-credential {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Floating Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #005f73;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 95, 115, 0.35);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background: #0a9396;
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(10, 147, 150, 0.45);
}

/* Sticky Header & Top Notice Banner on Desktop/Computer */
@media (min-width: 768px) {
  #top-notice-banner {
    position: sticky;
    top: 0;
    z-index: 50;
  }
  #navbar {
    top: var(--top-banner-height, 41px);
    z-index: 40;
  }
}

