/* ============================================
   BODY MAP SECTION - Interactive HBOT Applications
   Version: 3.0 - Modern Glassmorphism
   Last Updated: 2026-03-08
   ============================================ */

/* === CSS Variables === */
:root {
  --bodymap-bg: #574c3f;
  --bodymap-bg-secondary: rgba(20, 20, 20, 0.6);
  --bodymap-text: #ffffff;
  --bodymap-text-muted: rgba(255, 255, 255, 0.7);
  --bodymap-border: rgba(255, 255, 255, 0.1);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glass-blur: blur(12px);
  
  /* Category Colors */
  --category-pain: #FF6B6B;
  --category-wound: #FFA502;
  --category-rehab: #A55EEA;
  --category-longevity: #26DE81;
  
  /* Spacing - Daha kompakt */
  --bodymap-gap: 25px;
  --bodymap-padding: 30px;
}

/* === Section Container === */
.layout-bodymap {
  background: var(--bodymap-bg);
  padding: 15px 0 15px 0;
  min-height: auto;
  position: relative;
  overflow: hidden;
}

.layout-bodymap .container-xl {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Title - Bir önceki section ile tamamen aynı stil === */
.layout-bodymap .title {
  text-align: center;
  margin-bottom: 5px;
  padding-bottom: 0 !important;
}

/* LEARN alt başlığı - DISCOVER ile aynı stil */
.layout-bodymap .title .title-text:first-child {
  font-size: 14px;
  letter-spacing: 3px;
  color: #b9a590;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Ana başlık */
.layout-bodymap .title .title-text:last-child {
  font-size: 42px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin: 0;
}

/* === Category Buttons - Glassmorphism === */
.category-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 35px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.category-btn {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 2px solid var(--glass-border);
  border-radius: 30px;
  color: var(--bodymap-text-muted);
  padding: 14px 32px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.category-btn::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.category-btn:hover {
  color: var(--bodymap-text);
  border-color: var(--bodymap-text-muted);
}

.category-btn:hover::before {
  transform: scaleX(1);
}

/* Category Active States */
.category-btn.active[data-category="pain"],
.category-btn[data-category="pain"]:hover {
  border-color: var(--category-pain);
  color: var(--category-pain);
}

.category-btn.active[data-category="pain"]::before {
  background: var(--category-pain);
  transform: scaleX(1);
}

.category-btn.active[data-category="wound"],
.category-btn[data-category="wound"]:hover {
  border-color: var(--category-wound);
  color: var(--category-wound);
}

.category-btn.active[data-category="wound"]::before {
  background: var(--category-wound);
  transform: scaleX(1);
}

.category-btn.active[data-category="rehab"],
.category-btn[data-category="rehab"]:hover {
  border-color: var(--category-rehab);
  color: var(--category-rehab);
}

.category-btn.active[data-category="rehab"]::before {
  background: var(--category-rehab);
  transform: scaleX(1);
}

.category-btn.active[data-category="longevity"],
.category-btn[data-category="longevity"]:hover {
  border-color: var(--category-longevity);
  color: var(--category-longevity);
}

.category-btn.active[data-category="longevity"]::before {
  background: var(--category-longevity);
  transform: scaleX(1);
}

/* === Main Content Area === */
.bodymap-main {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: var(--bodymap-gap);
  align-items: start;
  position: relative;
  min-height: 450px;
}

/* === Info Boxes Container === */
.info-boxes {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-top: 25px;
  align-self: start;
}

.info-boxes-left {
  align-items: flex-end;
  text-align: right;
}

.info-boxes-right {
  align-items: flex-start;
  text-align: left;
}

/* === Info Box - Glassmorphism === */
.info-box {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 15px;
  max-width: 260px;
  position: relative;
  opacity: 0;
  transform: translateX(20px);
  animation: infoBoxFadeIn 0.5s ease forwards;
  transition: all 0.3s ease;
  box-shadow: var(--glass-shadow);
}

.info-boxes-left .info-box {
  transform: translateX(-20px);
}

.info-box:hover {
  border-color: var(--info-box-color, var(--glass-border));
  box-shadow: 0 0 20px rgba(var(--info-box-color-rgb, 255, 255, 255), 0.1);
}

/* Info Box Hover - Point Sync */
.info-box:hover .info-box-indicator {
  transform: scale(1.5);
  box-shadow: 0 0 15px var(--info-box-color, var(--glass-border));
}

.info-box.highlighted {
  border-color: var(--info-box-color, var(--glass-border));
  box-shadow: 0 0 25px rgba(var(--info-box-color-rgb, 255, 255, 255), 0.2);
  transform: scale(1.02);
}

.info-box.highlighted .info-box-indicator {
  transform: scale(1.5);
  box-shadow: 0 0 15px var(--info-box-color, var(--glass-border));
}

/* === Info Box Expanded Mode (Zoom Active) - Side Panel === */
.info-box.expanded {
  position: relative;
  max-width: 350px;
  width: 100%;
  padding: 20px;
  z-index: 100;
  border-color: var(--info-box-color, var(--glass-border));
  box-shadow: 0 0 40px rgba(var(--info-box-color-rgb, 255, 255, 255), 0.3);
  animation: expandSidePanel 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Sol taraftaki expanded panel */
.info-boxes-left .info-box.expanded {
  transform-origin: right center;
}

/* Sağ taraftaki expanded panel */
.info-boxes-right .info-box.expanded {
  transform-origin: left center;
}

@keyframes expandSidePanel {
  0% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Header container - back button ve title yan yana */
.info-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

/* Sol taraftaki kutucuklar - sağa dayalı */
.info-boxes-left .info-box-header {
  justify-content: flex-end;
}

.info-boxes-left .info-box {
  text-align: right;
}

/* Normal modda back button gizli, sadece title görünür */
.info-box:not(.expanded) .info-box-header {
  margin-bottom: 8px;
}

.info-box:not(.expanded) .info-box-back-btn {
  display: none;
}

/* Expanded modda header */
.info-box.expanded .info-box-header {
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}

/* Sol taraftaki info box - back solda, title sağda */
.info-boxes-left .info-box.expanded .info-box-header {
  flex-direction: row;
  justify-content: space-between;
}

/* Sağ taraftaki info box - back sağda, title solda */
.info-boxes-right .info-box.expanded .info-box-header {
  flex-direction: row-reverse;
  justify-content: space-between;
}

/* Sağ taraftaki kutucuklar - sola dayalı */
.info-boxes-right .info-box {
  text-align: left;
}

.info-box.expanded .info-box-title {
  font-size: 22px;
  margin: 0;
  font-weight: 800;
  flex: 1;
}

/* Normal modda title eski stilinde */
.info-box:not(.expanded) .info-box-title {
  margin: 0;
}

.info-box.expanded .info-box-desc {
  display: none; /* Kısa açıklama gizlensin */
}

.info-box.expanded .info-box-long-desc {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 15px;
  color: var(--bodymap-text-muted);
  font-weight: 500;
  text-align: left;
}

/* Sol taraftaki info box'ların uzun açıklaması sağa dayalı */
.info-boxes-left .info-box.expanded .info-box-long-desc {
  text-align: right;
}

.info-box.expanded .info-box-indicator {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 20px var(--info-box-color, var(--glass-border));
}

/* Back Button */
.info-box-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 25px;
  color: var(--bodymap-text);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.info-box-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--info-box-color, var(--bodymap-text-muted));
  color: var(--info-box-color, var(--bodymap-text));
  box-shadow: 0 0 15px rgba(var(--info-box-color-rgb, 255, 255, 255), 0.3);
}

.info-box-back-btn svg {
  width: 16px;
  height: 16px;
}

/* Overlay for expanded mode - ARTIK KULLANILMIYOR */
.bodymap-overlay {
  display: none;
}

/* Hide other info boxes when one is expanded - SMOOTH FADE */
.bodymap-main.zoomed .info-box:not(.expanded) {
  opacity: 0 !important;
  pointer-events: none;
  transform: scale(0.9);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Zoom modunda expanded info box daha geniş */
.bodymap-main.zoomed .info-box.expanded {
  max-width: 380px;
  padding: 25px;
}

/* Cursor pointer for info boxes */
.info-box {
  cursor: pointer;
}

.info-box-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: absolute;
  top: 15px;
  transition: all 0.3s ease;
}

.info-boxes-left .info-box-indicator {
  right: -22px;
}

.info-boxes-right .info-box-indicator {
  left: -22px;
}

.info-box-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--info-box-color, var(--bodymap-text));
  margin: 0 0 8px 0;
  text-shadow: 0 0 10px var(--info-box-color, transparent);
}

.info-box-desc {
  font-size: 15px;
  color: var(--bodymap-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* Info Box Animation Delay */
.info-box:nth-child(1) { animation-delay: 0.1s; }
.info-box:nth-child(2) { animation-delay: 0.2s; }
.info-box:nth-child(3) { animation-delay: 0.3s; }
.info-box:nth-child(4) { animation-delay: 0.4s; }

@keyframes infoBoxFadeIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* === Body Map Container (Center) === */
.bodymap-container {
  position: relative;
  width: 100%;
  height: 450px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
  background: var(--bodymap-bg);
  border-radius: 20px;
}

#bodymap-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* === Connection Lines SVG === */
.connection-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.connection-line {
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 5, 5;
  animation: dashMove 1s linear infinite;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -10;
  }
}

/* === Loading State === */
.bodymap-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.bodymap-loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--category-longevity);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.bodymap-loading-text {
  color: var(--bodymap-text-muted);
  font-size: 12px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Large Desktop (>1400px) */
@media (min-width: 1400px) {
  .layout-bodymap .title-text {
    font-size: 32px;
  }
  
  .bodymap-main {
    gap: 40px;
  }
  
  .info-box {
    max-width: 280px;
  }
  
  .bodymap-container {
    height: 650px;
  }
}

/* Desktop (1000px - 1399px) */
@media (max-width: 1399px) {
  .bodymap-main {
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 20px;
  }
  
  /* Sağ taraftaki info box'lara sol taraftaki ile simetrik boşluk */
  .info-boxes-right {
    padding-right: 20px;
  }
  
  .info-box {
    max-width: 220px;
    padding: 12px;
  }
  
  /* Expanded mode - Desktop */
  .info-box.expanded {
    max-width: 320px;
  }
  
  .bodymap-main.zoomed .info-box.expanded {
    max-width: 340px;
  }
  
  .bodymap-container {
    height: 500px;
  }
}

/* Tablet (768px - 999px) */
@media (max-width: 999px) {
  .layout-bodymap .title-text {
    font-size: 22px;
    letter-spacing: 2px;
  }
  
  .category-buttons {
    gap: 6px;
  }
  
  .category-btn {
    padding: 6px 14px;
    font-size: 11px;
  }
  
  /* Grid yapısını koru, sadece boyutları küçült */
  .bodymap-main {
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 15px;
  }
  
  .bodymap-container {
    height: 400px;
  }
  
  /* Sağ/sol ayrımını koru */
  .info-boxes-left {
    align-items: flex-end;
    text-align: right;
  }
  
  .info-boxes-right {
    align-items: flex-start;
    text-align: left;
    padding-right: 15px;
  }
  
  .info-box {
    max-width: 160px;
    padding: 10px;
  }
  
  /* Expanded mode - Tablet */
  .info-box.expanded {
    max-width: 240px;
    padding: 15px;
  }
  
  .bodymap-main.zoomed .info-box.expanded {
    max-width: 260px;
  }
  
  .info-box.expanded .info-box-title {
    font-size: 18px;
  }
  
  .info-box.expanded .info-box-long-desc {
    font-size: 14px;
  }
  
  .info-box-title {
    font-size: 14px;
  }
  
  .info-box-desc {
    font-size: 12px;
  }
  
  .info-box-indicator {
    display: none;
  }
  
  .connection-lines {
    display: none;
  }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
  .layout-bodymap {
    padding: 25px 0;
  }
  
  .layout-bodymap .container-xl {
    padding: 0 15px;
  }
  
  .layout-bodymap .title-text {
    font-size: 18px;
    letter-spacing: 1px;
    padding: 6px 16px;
  }
  
  .category-buttons {
    gap: 6px;
    margin-bottom: 20px;
  }
  
  .category-btn {
    padding: 6px 12px;
    font-size: 10px;
    border-width: 1px;
  }
  
  /* Grid yapısını koru, sadece boyutları küçült */
  .bodymap-main {
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 10px;
  }
  
  .bodymap-container {
    height: 350px;
  }
  
  /* Sağ/sol ayrımını koru */
  .info-boxes-left {
    align-items: flex-end;
    text-align: right;
  }
  
  .info-boxes-right {
    align-items: flex-start;
    text-align: left;
    padding-right: 10px;
  }
  
  .info-boxes {
    gap: 8px;
  }
  
  .info-box {
    max-width: 120px;
    padding: 8px;
  }
  
  /* Expanded mode - Mobile */
  .info-box.expanded {
    max-width: 180px;
    padding: 12px;
  }
  
  .bodymap-main.zoomed .info-box.expanded {
    max-width: 200px;
  }
  
  .info-box.expanded .info-box-title {
    font-size: 14px;
  }
  
  .info-box.expanded .info-box-long-desc {
    font-size: 11px;
    line-height: 1.5;
  }
  
  .info-box.expanded .info-box-back-btn {
    padding: 5px 10px;
    font-size: 9px;
  }
  
  .info-box.expanded .info-box-back-btn svg {
    width: 10px;
    height: 10px;
  }
  
  .info-box-title {
    font-size: 11px;
  }
  
  .info-box-desc {
    font-size: 9px;
  }
}

/* Small Mobile (<480px) */
@media (max-width: 479px) {
  .layout-bodymap .title-text {
    font-size: 16px;
  }
  
  .category-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .category-btn {
    width: 100%;
    text-align: center;
  }
  
  /* Grid yapısını koru, sadece boyutları küçült */
  .bodymap-main {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  
  .bodymap-container {
    height: 280px;
  }
  
  /* Sağ/sol ayrımını koru */
  .info-boxes-left {
    align-items: flex-end;
    text-align: right;
  }
  
  .info-boxes-right {
    align-items: flex-start;
    text-align: left;
    padding-right: 8px;
  }
  
  .info-box {
    max-width: 100px;
    padding: 6px;
  }
  
  /* Expanded mode - Small Mobile */
  .info-box.expanded {
    max-width: 140px;
    padding: 10px;
  }
  
  .bodymap-main.zoomed .info-box.expanded {
    max-width: 160px;
  }
  
  .info-box.expanded .info-box-title {
    font-size: 12px;
  }
  
  .info-box.expanded .info-box-long-desc {
    font-size: 10px;
    line-height: 1.4;
    margin-bottom: 8px;
  }
  
  .info-box.expanded .info-box-back-btn {
    padding: 4px 8px;
    font-size: 8px;
  }
  
  .info-box.expanded .info-box-back-btn svg {
    width: 8px;
    height: 8px;
  }
  
  .info-box-title {
    font-size: 9px;
  }
  
  .info-box-desc {
    font-size: 8px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .category-btn::before,
  .info-box,
  .connection-line,
  .bodymap-loading-spinner {
    animation: none;
    transition: none;
  }
  
  .info-box {
    opacity: 1;
    transform: none;
  }
}

/* Focus States */
.category-btn:focus {
  outline: 2px solid var(--bodymap-text);
  outline-offset: 2px;
}

.info-box:focus-within {
  outline: 2px solid var(--bodymap-text);
  outline-offset: 2px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Category Color Classes */
.category-pain { --info-box-color: var(--category-pain); --info-box-color-rgb: 255, 107, 107; }
.category-wound { --info-box-color: var(--category-wound); --info-box-color-rgb: 255, 165, 2; }
.category-rehab { --info-box-color: var(--category-rehab); --info-box-color-rgb: 165, 94, 234; }
.category-longevity { --info-box-color: var(--category-longevity); --info-box-color-rgb: 38, 222, 129; }

/* ============================================
   FALLBACK MODE (WebGL not supported)
   ============================================ */

.bodymap-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  text-align: center;
  padding: 40px;
}

.bodymap-fallback .fallback-content {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 25px;
  max-width: 350px;
  box-shadow: var(--glass-shadow);
}

.bodymap-fallback p {
  color: var(--bodymap-text-muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.6;
}

/* Fallback Mode Layout */
.bodymap-main.fallback-mode {
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.bodymap-main.fallback-mode .bodymap-container {
  display: none;
}

.bodymap-main.fallback-mode .info-boxes {
  flex: 1;
}

@media (max-width: 768px) {
  .bodymap-main.fallback-mode {
    grid-template-columns: 1fr;
  }
}
