/* Global reset and body styles */
body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: #f4f4f4;
}

/* Header with banner image */
header {
    width: 100%;
    background-color: #000;
    text-align: center;
    padding: 0;
}

#banner-image {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Main navigation menu */
#main-menu {
    background-color: #333;
    padding: 15px 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.menu-button {
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    transition: background 0.3s, transform 0.3s;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
}

.menu-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.05);
}

/* Highlight active menu button */
.menu-button.active {
    background: linear-gradient(135deg, #0051a8, #003a70);
}

/* Landing page content */
#landing-content {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
    text-align: center;
}

#landing-content h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #007aff;
}

#landing-content p {
    font-size: 20px;
    margin-bottom: 40px;
    color: #333;
}

/* Landing page tiles */
#landing-tiles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

.landing-tile {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    width: 300px;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, box-shadow 0.3s;
}

.landing-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0px 8px 20px rgba(0,0,0,0.3);
}

.landing-tile img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.landing-tile h2 {
    margin: 15px 0;
    font-size: 22px;
}

/* Chapters grid */
#chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Chapter link */
.chapter-link {
    text-decoration: none;
    color: inherit;
}

/* Chapter tiles */
.chapter-tile {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.chapter-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0px 8px 20px rgba(0,0,0,0.3);
}

.chapter-tile img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.chapter-tile h2 {
    font-size: 20px;
    margin: 20px 0;
    color: #333;
}

/* Chapter page content */
#chapter-content {
    width: 90%;
    max-width: 1100px;
    margin: 50px auto;
    padding: 0 20px;
    font-size: 18px;
    line-height: 1.7;
    color: #333;
}

/* Chapter main title */
#chapter-content h1 {
    font-size: 40px;
    text-align: center;
    margin-bottom: 50px;
    color: #007aff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Chapter section titles */
#chapter-content h2 {
    font-size: 30px;
    margin-top: 50px;
    margin-bottom: 20px;
    color: #0051a8;
    position: relative;
    padding-bottom: 10px;
}

#chapter-content h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #007aff;
    margin-top: 10px;
    border-radius: 2px;
}

/* Paragraphs */
#chapter-content p {
    margin-bottom: 30px;
}

/* Media placeholder */
.media-placeholder {
    background: repeating-linear-gradient(
        45deg,
        #ddd,
        #ddd 10px,
        #eee 10px,
        #eee 20px
    );
    border: 3px dashed #bbb;
    height: 250px;
    margin: 30px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: italic;
    color: #666;
    font-size: 18px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
}

/* Standard viewer in chapters */
.viewer-embed-portrait {
    width: 100%;
    max-width: 1000px;
    height: 600px;
    margin: 30px auto;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-embed-portrait iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Full viewer + menu (Atlas viewer) */
#main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    margin: 40px auto;
    width: 90%;
    max-width: 1400px;
}

#viewer-container {
    flex: 1;
    height: 600px;
    background: #000;
    border-radius: 10px;
    box-shadow: 0px 0px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;

  position: relative;}

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#menu {
    flex: 0 0 250px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0px 0px 15px rgba(0,0,0,0.3);
}

/* Reset button */
.reset-button {
    display: block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.3s, transform 0.3s;
}

.reset-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.05);
}

/* Highlighted label */
.highlighted-label {
    background-color: lightgreen;
    border-radius: 5px;
    padding: 2px 5px;
}

/* Fade-in effect */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation button */
.chapter-navigation {
    text-align: center;
    margin: 60px 0 20px 0;
}

.nav-button {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    color: white;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s, transform 0.3s;
}

.nav-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.05);
}

/* ========================== */
/* 📱 MOBILE OPTIMIZATION 📱 */
/* ========================== */
@media (max-width: 768px) {

    #main-menu {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    #main-content {
        flex-direction: column;
        align-items: center;
    }

    #viewer-container {
        width: 100%;
        max-width: 100%;
        height: 400px;
    
  position: relative;}

    #menu {
        width: 100%;
        max-height: none;
        margin-top: 20px;
    }

    .viewer-embed-portrait {
        height: 400px;
    }

    #landing-content {
        padding: 0 10px;
    }

    #chapter-content {
        padding: 0 15px;
    }

    .menu-button {
        width: 80%;
        text-align: center;
    }
}

.group-header {
    cursor: pointer;
    font-weight: bold;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none; /* prevent text selection */
}

.triangle {
    display: inline-block;
    width: 10px;
    cursor: pointer;   /* make triangle also a pointer */
    user-select: none; /* prevent selection */
}
/* Quiz styles */
#quiz-container {
    margin-top: 40px;
}

#progress-bar-container {
    width: 100%;
    background: #ddd;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 30px;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    width: 0%;
    transition: width 0.5s ease;
}

.choice-button {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: white;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

.choice-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.02);
}

.correct-choice {
    background: #4CAF50 !important; /* Bright green solid */
    color: white !important;
    box-shadow: none !important;
    transform: none !important;
}

.wrong-choice {
    background: #e74c3c !important; /* Red solid */
    color: white !important;
    box-shadow: none !important;
    transform: none !important;
}

#score {
    text-align: center;
    font-size: 22px;
    margin-top: 50px;
}

#score h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #007aff;
}
#next-button {
    display: inline-block;
    padding: 14px 30px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 30px;
    transition: background 0.3s, transform 0.3s;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

#next-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.05);
}
/* Circle progress bar */
#progress-circle-container {
    width: 120px;
    height: 120px;
    margin: 20px auto;
}

#progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-background {
    fill: none;
    stroke: #ddd;
    stroke-width: 10;
}

.progress-bar {
    fill: none;
    stroke: #4a90e2;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.5s ease;
}

#progress-text {
    fill: #333;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
}
#progress-wrapper {
    text-align: center;
    margin-bottom: 30px;
}

#progress-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
}

#progress-circle-container {
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

#progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-background {
    fill: none;
    stroke: #ddd;
    stroke-width: 10;
}

.progress-bar {
    fill: none;
    stroke: #4a90e2;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease;
}

.progress-bar.completed {
    stroke: #4CAF50; /* bright green when complete */
    filter: drop-shadow(0px 0px 10px #4CAF50);
}

#progress-text {
    fill: #333;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
}
/* Hero section styles */
#hero-content {
    text-align: center;
    margin: 60px auto;
    padding: 20px;
    max-width: 800px;
}

#hero-content h1 {
    font-size: 42px;
    margin-bottom: 20px;
    color: #007aff;
}

#hero-content p {
    font-size: 22px;
    margin-bottom: 40px;
    color: #444;
    line-height: 1.5;
}

#hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-button {
    padding: 14px 30px;
    background: linear-gradient(135deg, #4a90e2, #007aff);
    color: white;
    border: none; /* <-- ADD THIS LINE to remove the black edge */
    border-radius: 30px;
    font-size: 20px;
    text-decoration: none;
    cursor: pointer; /* <-- ADD THIS LINE for better hover behavior */
    transition: background 0.3s, transform 0.3s;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
}

.hero-button:hover {
    background: linear-gradient(135deg, #007aff, #0051a8);
    transform: translateY(-2px) scale(1.05);
}
/* Hero content animation */
.fade-in-hero {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.fade-in-hero.visible {
    opacity: 1;
    transform: translateY(0);
}
#hero-content h1 {
    font-size: 60px;
    margin-bottom: 20px;
    color: #007aff;
    letter-spacing: 2px;
    text-transform: uppercase;
}
#glossary-content {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
    text-align: center;
}

#glossary-controls {
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

#tooltip {
    position: absolute;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    pointer-events: none;
    font-size: 14px;
    max-width: 300px;
    display: none;
    z-index: 1000;
}

.glossary-item strong {
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.glossary-item strong:hover {
    background-color: #e0f0ff;
}

#glossary-content h1 {
    font-size: 50px;
    color: #007aff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 50px;
}

#glossary-list h2 {
    font-size: 36px;
    color: #0051a8;
    margin-top: 50px;
    margin-bottom: 20px;
    text-align: center; /* <-- Center the A, B, C and Tissue type headers */
    padding-bottom: 10px;
    border-bottom: 2px solid #007aff;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.glossary-sources {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.glossary-source-link {
    font-size: 14px;
    color: #007aff;
    text-decoration: none;
}

.glossary-source-link:hover {
    text-decoration: underline;
}
#search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-bottom: 30px;
}

#search-input {
    width: 300px;
    padding: 10px;
    font-size: 16px;
    border-radius: 20px;
    border: 1px solid #ccc;
    outline: none;
    text-align: center;
}

#suggestions {
    position: absolute;
    top: 50px;
    width: 300px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #f0f0f0;
}

.highlight {
    background-color: yellow;
    transition: background-color 2s ease;
}
#structure-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    background-color: #333;
    padding: 0.5rem 1rem;
    margin: 0 auto 1rem auto;
    max-width: 1000px;
    text-align: center;
    border-radius: 8px;
}
.selected-label {
    background-color: rgba(0, 255, 255, 0.15); /* light cyan */
    border-left: 4px solid cyan;
    padding-left: 6px;
}
.region-header {
    margin: 40px 0 20px 0;
    text-align: left;
}

.region-header h2 {
    font-size: 32px;
    color: #003a70;
    margin-bottom: 10px;
    border-left: 5px solid #007aff;
    padding-left: 10px;
}

.subregion-block {
    margin-bottom: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0px 2px 10px rgba(0,0,0,0.1);
    padding: 10px 20px;
    text-align: left;
}

.subregion-block summary {
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    color: #007aff;
    margin-bottom: 10px;
    user-select: none;
}

.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start; /* align from left */
}

.model-grid .landing-tile {
    width: 240px;
    flex: 0 0 auto;
    text-align: center;
}

#region-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center; /* ⬅️ center horizontally */
}
  
  .region-tab {
    padding: 8px 16px;
    border: 2px solid #007aff;
    border-radius: 6px;
    background-color: white;
    color: #007aff;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    text-decoration: none; /* remove underline */
  }
  
  .region-tab.active {
    background-color: #007aff;
    color: white;
  }
  
  .subregion-section {
    margin-bottom: 40px;
  }
  
  .subregion-section h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #003a70;
  }
  
  .model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }
  
  .model-grid .landing-tile {
    width: 260px;
    text-align: center;
  }
  
  .model-grid .landing-tile img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
  }
  #atlas-container {
    width: 90%;
    max-width: 1100px;
    margin: 50px auto;
    padding: 0 20px;    
  }

#muscle-tooltip {
  position: absolute;
  display: none;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  z-index: 1000;
  max-width: 320px;
  pointer-events: none;
  line-height: 1.5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.label.origin {
  color: #ff4d4d;  /* red */
  font-weight: bold;
}
.label.insertion {
  color: #4da6ff;  /* blue */
  font-weight: bold;
}
.label.nerve {
  color: #33cc33;  /* green */
  font-weight: bold;
}

strong.muscle-hover {
  cursor: help;
  border-bottom: 1px dotted #888;
}

#muscle-tooltip {
    position: absolute;
    display: none;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    z-index: 1000;
    max-width: 320px;
    pointer-events: none;
    line-height: 1.5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  }
  
  .label.origin {
    color: #ff4d4d;  /* red */
    font-weight: bold;
  }
  .label.insertion {
    color: #4da6ff;  /* blue */
    font-weight: bold;
  }
  .label.nerve {
    color: #33cc33;  /* green */
    font-weight: bold;
  }
  
  strong.muscle-hover {
    cursor: help;
    border-bottom: 1px dotted #888;
  }


/* Fullscreen expansion styles */
#viewer-container:fullscreen {
  height: 100vh !important;
  width: 100vw !important;
  border-radius: 0;
  box-shadow: none;
}

#renderCanvas:fullscreen {
  height: 100vh !important;
  width: 100vw !important;
  display: block;
}

#menu:fullscreen {
  display: none;
}

#structure-label:fullscreen {
  max-width: none;
  font-size: 1.5rem;
}

/* ── Fullscreen: float the sidebar inside viewer + menu ── */
#main-content:fullscreen {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: flex-start;
  }
  
  #main-content:fullscreen #viewer-container {
    flex: 1;
    height: 100%;
  
  position: relative;}
  
  #main-content:fullscreen #menu {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 250px;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    overflow-y: auto;
    z-index: 100;
  }
  
  #fullscreen-wrapper {
    position: relative;
  }
  
  #fullscreen-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    font-size: 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
  }



/* Ensure layout adjusts correctly in fullscreen mode */
#main-content:fullscreen {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
}

#main-content:fullscreen #viewer-container {
    flex: 1;
    position: relative;
    height: 100%;
}

#main-content:fullscreen #renderCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

#main-content:fullscreen #menu {
    width: 300px;
    background: #111;
    color: white;
    overflow-y: auto;
}


/* Fix Babylon canvas resizing while keeping menu in fullscreen mode */
#main-content:fullscreen {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#main-content:fullscreen #viewer-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#main-content:fullscreen #viewer-container {
    flex: 1;
    position: relative;
    height: 100%;
    width: 100%;
}

#main-content:fullscreen #renderCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

#main-content:fullscreen #menu {
    width: 300px;
    background: #111;
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}
/* ---- Unified thumbnail tile behavior site-wide ---- */

/* ensure link tiles don’t turn browser-blue */
.landing-tile,
.landing-tile:link,
.landing-tile:visited {
  color: #333;
  text-decoration: none;
}

/* normalize title size/weight (regions.html uses h2; others sometimes h3) */
.landing-tile h2,
.landing-tile h3 {
  margin: 15px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

/* lock tile image behavior for your new square thumbs */
.landing-tile img {
  width: 100%;
  height: 200px;       /* matches existing tiles */
  object-fit: cover;   /* square thumbs fill nicely */
  display: block;
}
