body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #35424a;
    color: #ffffff;
    padding: 1rem 0;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

.task-selector {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.task-selector label {
    font-size: 1.1rem;
    font-weight: 500;
}

.task-selector select {
    background-color: #ffffff;
    border: 2px solid #27ae60;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.task-selector select:hover {
    border-color: #219a52;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.task-selector select:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

#taskDescription {
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
    color: #555;
}

main {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column; 
    align-items: center; 
}

/* New layout structure */
.interactive-area {
    display: flex;
    flex-direction: row; /* Side-by-side on wider screens */
    justify-content: center;
    align-items: flex-start; /* Align at the top */
    width: 100%;
    max-width: 1200px; /* Maximum width for very large screens */
    gap: 1.5rem; /* Space between image and details */
    transition: all 0.4s ease;
}

.interactive-area.showing-info {
    justify-content: flex-start;
}

.image-container {
    position: relative;
    width: 45%; /* Takes 45% of the interactive-area width */
    max-width: 600px;
    margin: 0; /* Reset margin */
    transition: all 0.4s ease;
}

.details-panel {
    width: 50%; /* Takes 50% of the interactive-area width */
    display: none; /* Hidden by default */
    flex-direction: column;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.details-panel.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#skinfoldImage {
    max-width: 100%;
    height: auto;
    display: block;
}

/* SVG Measurement Element Styling */
.measurement-element {
    cursor: pointer;
    transition: all 0.3s ease;
}

.measurement-line {
    stroke-width: 0.5%;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.measurement-endpoint {
    stroke-width: 0.3%;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.measurement-arc {
    fill: none;
    stroke-width: 0.4%;
    stroke-dasharray: 2% 1%;
    cursor: pointer;
    pointer-events: all;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

/* Lengths styling */
.lengths-element .measurement-line {
    stroke: rgba(255, 165, 0, 0.8);
}

.lengths-element .measurement-endpoint {
    fill: rgba(255, 165, 0, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.lengths-element:hover .measurement-line {
    stroke: rgba(255, 165, 0, 1);
    stroke-width: 0.7%;
}

.lengths-element:hover .measurement-endpoint {
    fill: rgba(255, 165, 0, 1);
    stroke: rgba(255, 255, 255, 1);
}

/* Breadths styling */
.breadths-element .measurement-line {
    stroke: rgba(0, 128, 0, 0.8);
}

.breadths-element .measurement-endpoint {
    fill: rgba(0, 128, 0, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.breadths-element:hover .measurement-line {
    stroke: rgba(0, 128, 0, 1);
    stroke-width: 0.7%;
}

.breadths-element:hover .measurement-endpoint {
    fill: rgba(0, 128, 0, 1);
    stroke: rgba(255, 255, 255, 1);
}

/* Girths styling */
.girths-element .measurement-arc {
    stroke: rgba(128, 0, 128, 0.8);
}

.girths-element:hover .measurement-arc {
    stroke: rgba(128, 0, 128, 1);
    stroke-width: 0.6%;
}

/* Selected state for measurement elements */
.measurement-element.element-selected .measurement-line {
    stroke: teal;
    stroke-width: 0.8%;
}

.measurement-element.element-selected .measurement-endpoint {
    fill: teal;
    stroke: white;
}

.measurement-element.element-selected .measurement-arc {
    stroke: teal;
    stroke-width: 0.7%;
}

/* Original dot styling for skinfolds and landmarks */
.measurement-dot {
    stroke-width: 0.3%;
    cursor: pointer;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.skinfolds-dot {
    fill: rgba(255, 0, 0, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.skinfolds-dot:hover {
    fill: rgba(255, 0, 0, 1);
    stroke: rgba(255, 255, 255, 1);
}

.landmarks-dot {
    fill: rgba(0, 150, 255, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.landmarks-dot:hover {
    fill: rgba(0, 150, 255, 1);
    stroke: rgba(255, 255, 255, 1);
}

.lengths-dot {
    fill: rgba(255, 165, 0, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.lengths-dot:hover {
    fill: rgba(255, 165, 0, 1);
    stroke: rgba(255, 255, 255, 1);
}

.girths-dot {
    fill: rgba(128, 0, 128, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.girths-dot:hover {
    fill: rgba(128, 0, 128, 1);
    stroke: rgba(255, 255, 255, 1);
}

.breadths-dot {
    fill: rgba(0, 128, 0, 0.7);
    stroke: rgba(255, 255, 255, 0.9);
}

.breadths-dot:hover {
    fill: rgba(0, 128, 0, 1);
    stroke: rgba(255, 255, 255, 1);
}

.measurement-dot.dot-selected {
    fill: teal;
    stroke: none;
}

/* Ensure SVG overlays image correctly */
#skinfoldDots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

area:hover {
    cursor: pointer;
}

/* Info display and video container adjustments */
.info-display-area, .video-player-container {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100%; /* Take full width of the details-panel */
    max-width: 100%; /* Remove max-width restriction */
    margin-top: 0; /* Reset margin for stacked elements */
    margin-bottom: 1rem; /* Add space between elements when stacked */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease-in-out;
}

/* Keep first element in details-panel from having top margin */
.details-panel > div:first-child {
    margin-top: 0;
}

.info-display-area h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.75rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
}

.info-display-area h2::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: teal;
    border-radius: 50%;
    margin-right: 10px;
}

.info-display-area h4 {
    color: #2c3e50;
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    border-left: 4px solid #27ae60;
    padding-left: 0.75rem;
}

#infoContent {
    line-height: 1.7;
    color: #444;
}

#infoContent p {
    margin-bottom: 1rem;
}

#infoContent p strong {
    color: #2c3e50;
    font-weight: 600;
}

#infoContent ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

#infoContent li {
    margin-bottom: 0.75rem;
    position: relative;
}

#closeButton {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
    margin-top: 1.25rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 500;
}

#closeButton:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Video Player Styling - Update to match info panel */
.video-player-container {
    background-color: #f8f9fa;
    display: flex; /* For centering button */
    flex-direction: column; /* Stack iframe and button */
    align-items: center; /* Center button */
}

.video-player-container iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.video-controls {
    display: flex;
    gap: 1.5rem; /* Increased spacing between buttons */
    margin-top: 1.5rem; /* Increased top margin */
    justify-content: center; /* Center the buttons */
    width: 100%; /* Take full width */
}

#restartVideoButton {
    background-color: #27ae60; /* Green color for restart */
    color: white;
    border: none;
    padding: 0.75rem 1.25rem; /* Slightly larger padding */
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    min-width: 140px; /* Ensure consistent button width */
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#restartVideoButton:hover {
    background-color: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#closeVideoButton {
    background-color: #e57373; /* Softer red color */
    color: white;
    border: none;
    padding: 0.75rem 1.25rem; /* Slightly larger padding */
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    min-width: 140px; /* Ensure consistent button width */
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#closeVideoButton:hover {
    background-color: #ef5350; /* Slightly darker on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Responsive layout for smaller screens */
@media (max-width: 768px) {
    .interactive-area {
        flex-direction: column; /* Stack elements on smaller screens */
        align-items: center;
        justify-content: flex-start; /* Always start from top on mobile */
    }

    .interactive-area.showing-info {
        justify-content: flex-start; /* No change needed on mobile */
    }

    .image-container, .details-panel {
        width: 100%; /* Full width on smaller screens */
        max-width: 600px; /* Maintain reasonable width */
    }

    .details-panel {
        margin-top: 1.25rem; /* Add space between image and details */
    }
}

footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    font-size: 0.9rem;
}

/* Collapsible sections styling */
.collapsible-header {
    cursor: pointer;
    position: relative;
    padding-right: 30px;
    user-select: none;
    transition: all 0.3s ease;
}

.collapsible-header::after {
    content: "−";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: bold;
    color: #27ae60;
    width: 24px;
    text-align: center;
    line-height: 1;
}

.collapsible-header.collapsed::after {
    content: "+";
}

.collapsible-header:hover {
    color: #27ae60;
}

.collapsible-content {
    overflow: hidden;
    max-height: 1000px; /* Large enough to fit content */
    transition: max-height 0.4s ease-in-out;
}

.collapsible-content.collapsed {
    max-height: 0;
    transition: max-height 0.2s ease-in-out;
}

/* Add some spacing after each collapsible section */
.collapsible-section {
    margin-bottom: 1rem;
}

/* Add a hint that the headers are clickable */
.info-display-area h4.collapsible-header {
    cursor: pointer;
    background-color: #f8f9fa;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border-radius: 0.5rem;
    border-left: 4px solid #27ae60;
    transition: all 0.3s ease;
    position: relative;
}

.info-display-area h4.collapsible-header:hover {
    background-color: #edf2f7;
}

/* Toggle all button */
.toggle-all-button {
    display: none;
}

/* Add some space above the first collapsible section */
.collapsible-section:first-of-type {
    margin-top: 0.5rem;
}

/* Task Selector Buttons */
.task-buttons-container {
    display: flex;
    gap: 10px; /* Space between buttons */
    margin-bottom: 15px; /* Space below the button group */
    justify-content: center; /* Center the buttons */
}

.task-button {
    padding: 10px 20px; /* Slightly more horizontal padding */
    border: 1px solid transparent; /* Start with a transparent border */
    background-color: #e9ecef; /* Lighter, more neutral background for inactive */
    color: #495057; /* Darker grey for better contrast on light bg */
    cursor: pointer;
    border-radius: 20px; /* More rounded corners for a pill-like shape */
    font-size: 0.95em; /* Slightly smaller font for a cleaner look */
    font-weight: 500; /* Medium weight */
    transition: all 0.2s ease-in-out; /* Faster, smoother transition */
    outline: none; /* Remove default browser outline */
}

.task-button:hover {
    background-color: #dee2e6; /* Slightly darker on hover */
    border-color: #ced4da; /* Subtle border on hover */
    color: #343a40;
    transform: translateY(-1px); /* Slight lift on hover */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Subtle shadow on hover */
}

.task-button.active {
    background-color: #007bff; /* Bootstrap primary blue - or your preferred accent */
    color: white;
    border-color: #007bff;
    font-weight: 600; /* Bolder for active state */
    box-shadow: 0 3px 6px rgba(0, 123, 255, 0.25); /* Shadow for active button */
}

.task-button.active:hover {
    background-color: #0069d9; /* Darker shade of blue on hover for active button */
    border-color: #0062cc;
    transform: translateY(0); /* Reset transform if already lifted by general hover */
}

.task-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* Ensure header elements are centered nicely */
header {
    text-align: center;
    padding: 20px;
    background-color: #f0f0f0; /* Light background for the header */
    border-bottom: 1px solid #ddd;
    color: #333; /* Ensure text in header has good contrast */
}

header h1 {
    margin-bottom: 15px;
}

/* Coordinate Finding Mode Styles */
.coordinate-finding-active {
    position: relative;
}

.coordinate-finding-active::before {
    content: "⌖ COORDINATE FINDING MODE ACTIVE - Click anywhere on the image to get coordinates";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 193, 7, 0.95); /* Amber background */
    color: #212529;
    text-align: center;
    padding: 8px 16px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-bottom: 3px solid #ffc107;
    }
    50% {
        border-bottom: 3px solid #ff8c00;
    }
}

/* Basic measurements styles */
.element-selected {
    border-color: #007bff !important;
    background-color: #e3f2fd !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
}

/* Quiz Controls Styles */
.quiz-controls {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.quiz-mode-selector, .quiz-type-selector {
    display: flex;
    gap: 0.5rem;
}

.mode-button, .quiz-type-button {
    background-color: #ffffff;
    border: 2px solid #28a745;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #28a745;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mode-button:hover, .quiz-type-button:hover {
    background-color: #e8f5e8;
    transform: translateY(-1px);
}

.mode-button.active, .quiz-type-button.active {
    background-color: #28a745;
    color: #ffffff;
}

.quiz-progress {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.quiz-question {
    background-color: #ffffff;
    border: 2px solid #ffc107;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

.quiz-question h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.2rem;
}

.multiple-choice-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}

.choice-button {
    background-color: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.choice-button:hover {
    background-color: #e9ecef;
    border-color: #495057;
    transform: translateY(-1px);
}

.choice-button.correct {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.choice-button.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.choice-button.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
}

.quiz-feedback.correct {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.quiz-feedback.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.next-question-btn {
    background-color: #007bff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.next-question-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* Quiz Mode Visual States */
.quiz-mode .measurement-element,
.quiz-mode .measurement-dot {
    cursor: pointer;
    transition: filter 0.3s ease;
}

.quiz-mode .measurement-element:hover,
.quiz-mode .measurement-dot:hover {
    filter: brightness(1.2);
}

.quiz-mode .measurement-element.quiz-correct,
.quiz-mode .measurement-dot.quiz-correct {
    filter: hue-rotate(120deg) brightness(1.3);
}

.quiz-mode .measurement-element.quiz-incorrect,
.quiz-mode .measurement-dot.quiz-incorrect {
    filter: hue-rotate(0deg) brightness(1.5);
}

.quiz-mode .measurement-element.quiz-highlight,
.quiz-mode .measurement-dot.quiz-highlight {
    filter: hue-rotate(60deg) brightness(1.4);
    animation: glow 1s infinite;
}

.quiz-mode .measurement-element.quiz-highlight .measurement-arc,
.quiz-mode .measurement-element.element-selected.quiz-highlight .measurement-arc,
.quiz-mode .girths-element.quiz-highlight .measurement-arc,
.quiz-mode .girths-element.element-selected.quiz-highlight .measurement-arc {
    /* stroke: #ff0000 !important; */
    stroke-width: 1.2% !important;
    stroke-dasharray: none !important;
    animation: glow-arc 1s infinite;
}

@keyframes glow-arc {
    0% { 
        stroke-width: 1.2% !important; 
    }
    50% { 
        stroke-width: 1.4% !important; 
    }
    100% { 
        stroke-width: 1.2% !important; 
    }
}

@keyframes glow {
    0% { filter: hue-rotate(60deg) brightness(1.4); }
    50% { filter: hue-rotate(60deg) brightness(1.6); }
    100% { filter: hue-rotate(60deg) brightness(1.4); }
}

/* Hover Tooltip Styling */
.landmark-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.landmark-tooltip.visible {
    opacity: 1;
}

.landmark-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.9);
}