@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --primary-color: #0f3d73;
    --accent-color: #006994;
    --light-accent: #e3f2fd;
    --text-color: #1f2d3d;
    --caption-color: #546e7a;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh; /* ensures the full page fits exactly the viewport height */
}
/* Header */
header {
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-color)
    );
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

header p {
    font-size: 1rem;
    margin-top: 0.25rem;
    color: #e0f7fa;
}

/* ========= Redesigned Header ========= */
.header-container {
    display: flex;
    align-items: center;
    justify-content: center; /* Centers title section by default */
    position: relative;
}

.header-text {
    text-align: center;
    flex: 1;
}

.return-btn-header {
    position: absolute;
    left: 1.5rem;
    background-color: #ffffff25;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.return-btn-header:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Main */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* ✅ align content to top instead */
    padding: 2rem 1rem;
    overflow: auto; /* ✅ allow scrolling if content is tall */
}

h2 {
    font-size: 1.6rem;
    color: var(--primary-color);
    padding-bottom: 0.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Center + scale image & mask together */
#dimension-overview {
    position: relative;
    display: block;
    max-width: 800px;
    width: 35%;
    aspect-ratio: 2586 / 2547;
    line-height: 0;
}

.base-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.mask-overlay {
    position: absolute;
    top: 0;
    left: 0px;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.mask {
    fill: transparent;
    stroke: transparent;
    stroke-width: 5px;
    pointer-events: all;
    transition: all 0.25s ease;
    cursor: pointer;
}

.mask[target_dimension="none"] {
    cursor: default;
}

.mask:hover {
    stroke: #3ab4ff;
    stroke-width: 8px;
    animation: glow-outline-blue 1.6s ease-in-out infinite;
}

@keyframes glow-outline-blue {
    0% {
        stroke: #3ab4ff;
        filter: drop-shadow(0 0 3px #3ab4ff);
    }
    50% {
        stroke: #73d7ff;
        filter: drop-shadow(0 0 8px #73d7ff);
    }
    100% {
        stroke: #3ab4ff;
        filter: drop-shadow(0 0 3px #3ab4ff);
    }
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(25, 25, 25, 0.94);
    color: #f9f9f9;
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 220px;
    max-width: 350px;
    height: auto;
    pointer-events: none;
    opacity: 0;
    transform: translate(-100%, -120%) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    white-space: normal;
    z-index: 20;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: "Source Sans 3", "Inter", "Arial", sans-serif;
}

.tooltip.show {
    opacity: 1;
    transform: translate(-250%, -200%) scale(1);
}

/* Title: clear hierarchy, slightly larger font */
.tooltip-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #ffffff;
    margin-bottom: 6px;
    text-align: left;
    letter-spacing: 0.01em;
    white-space: normal; /* ✅ allows wrapping */
    word-break: break-word; /* ✅ prevents overflow on long words */
    margin-top: 5px;
    line-height: 1.3;
}

/* Description: improved contrast & readability */
.tooltip-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #dddddd;
    text-align: justify;
    text-justify: inter-word;
    margin-top: 10px;
}

/* Accessibility: respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .tooltip {
        transition: none;
        transform: translate(-50%, -130%) scale(1);
    }
}
/* Footer */
footer {
    background: linear-gradient(
        90deg,
        var(--accent-color),
        var(--primary-color)
    );
    color: #e0f7fa;
    text-align: center;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* Responsive tweaks */
@media (max-width: 900px) {
    .image-container {
        width: 80%;
    }

    header h1 {
        font-size: 1.5rem;
    }
    h2 {
        font-size: 1.3rem;
    }
}

.data-gallery-container {
    position: relative;
    width: 100%; /* take full parent width, not viewport */
    max-width: 1400px; /* optional: constrain maximum size */
    margin: 0 auto; /* ✅ center horizontally */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    background: linear-gradient(180deg, #f9fafb 0%, #eef2ff 100%);
}

/* ======== DATA CARD ======== */
.data-card {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 600px; /* lower limit */
    height: 750px; /* initial default */
    resize: vertical; /* ✅ allow vertical drag resizing */
    overflow: auto; /* ✅ needed for scroll inside */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 3rem;
    box-sizing: border-box;
    font-family: "Google Sans", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    min-width: 900px;
}

.data-card-header {
    display: flex;
    flex-wrap: wrap; /* allows wrapping on smaller screens */
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Individual header parts */
.data-card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f3d73;
    margin: 0;
}

.data-card-header .dimension-label {
    color: #475569;
    font-weight: 600;
    font-size: 0.95rem;
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    margin: 0;
}

.data-card-header .question-type {
    color: #1e3a8a;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(59, 130, 246, 0.12);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin: 0;
}

/* Optional: subtle divider line below header */
.data-card-header::after {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    background: #e0e7ff;
    margin-top: 0.5rem;
    border-radius: 2px;
}

.data-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.12);
}

/* ======== CARD HEADER (Question ID, Dimension, Type) ======== */
.data-card h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f3d73;
    text-align: center;
    margin-bottom: 0.2rem;
    letter-spacing: 0.3px;
}

.dimension-label {
    color: #475569;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.25rem;
    text-align: center;
}

.question-type {
    margin-top: 0.9rem;
    color: #1e3a8a;
    font-weight: 600;
    font-size: 1rem;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 1rem;
    border-radius: 20px;
}

/* ======== GALLERY ======== */
.gallery-wrapper {
    width: 100%;
    margin-top: 1.4rem;
    margin-bottom: 1.8rem;
}

.gallery.fixed-height {
    width: 100%;
    height: 450px; /* ✅ constant across entries */
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.gallery-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.transform-layer {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    translate: -50% -50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-image {
    /* width: 100%;
    height: 100%; */
    object-position: center;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease;
    display: block;
    max-width: none;
    width: 100%;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* ======== NAV BUTTONS (outer only) ======== */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 61, 115, 0.85);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease-in-out;
    opacity: 0.75;
}

.nav-btn:hover {
    background: linear-gradient(135deg, #1e40af, #0f3d73);
    transform: translateY(-50%) scale(1.08);
    opacity: 1;
}

.nav-btn.prev {
    left: 18px;
}

.nav-btn.next {
    right: 18px;
}

/* ======== QUESTION TEXT ======== */
.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: justify;
    line-height: 1.6;
    color: #0f3d73;
    padding: 0 1rem;
    border-top: 2px solid #e0e7ff;
    padding-top: 1rem;
}

/* ======== ANSWERS AREA ======== */
.answers {
    display: flex;
    flex-wrap: wrap; /* allow wrapping on small screens */
    gap: 8px; /* spacing between buttons */
    justify-content: center; /* center align the buttons */
    margin-top: 10px;
    width: 100%;
    max-width: 100%;
}

.answer-btn {
    padding: 0.6rem 1.4rem;
    margin: 0.4rem;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 500;
    cursor: default;
    transition: background-color 0.2s ease;
    font-size: 20px;
}

.answer-btn.correct {
    background: #22a24f;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(34, 162, 79, 0.25);
}

.option-item {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    width: fit-content;
    background: #f8fafc;
    color: #334155;
    font-weight: 500;
    font-size: 20px;
}

.option-item.correct {
    background: #38b64a;
    color: #fff;
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.25);
}

.local-note {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 0.75rem;
    font-style: italic;
}

/* ======== BOUNDING BOX ======== */
.bbox {
    position: absolute;
    border: 3px solid rgba(255, 59, 59, 0.85);
    box-shadow: 0 0 6px rgba(255, 59, 59, 0.5);
    pointer-events: none;
    z-index: 10;
    transition: all 0.1s ease;
}

.gallery-image.fade-enter {
    opacity: 0;
    transform: scale(0.98);
}
.gallery-image.fade-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 15;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.gallery-btn:hover {
    opacity: 1;
}
.gallery-btn.prev-inner {
    left: 10px;
}
.gallery-btn.next-inner {
    right: 10px;
}

/* ===== COMPACT, SCROLLABLE OPEN-ENDED ANSWER LIST ===== */
/* ===== ELEGANT + FIXED HEIGHT OPEN-ENDED ANSWER LIST ===== */
.answer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0.75rem 0 0.5rem 0;
    padding: 0.4rem 0.5rem 0.4rem 0.25rem;
    box-sizing: border-box;

    list-style: none; /* ✅ remove dot markers */
    overflow-y: auto; /* ✅ scroll content */
    scroll-behavior: smooth;
    scrollbar-gutter: stable; /* prevents small shifts */
}

/* individual open-ended answer block */
.answer-list li {
    position: relative;
    background: #f9fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.65rem 0.85rem 0.65rem 2.35rem;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.55;
    transition: all 0.2s ease-in-out;
    overflow-wrap: break-word;

    list-style: none; /* ✅ removes the native list dots */
    padding-left: 0; /* ✅ prevents default indentation */
    margin: 0; /* (optional) keeps spacing consistent */

    padding-left: 2.2rem; /* tweak to match your 💬 icon width */
}

/* Custom icon marker (no dot) */
.answer-list li::before {
    content: "💬";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.75;
}

/* Hover feedback */
.answer-list li:hover {
    background: #f1f5ff;
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.15);
}

/* Alternating tone for rhythm */
.answer-list li:nth-child(even) {
    background-color: #f3f6fb;
}

/* ===== Scrollbar refinement ===== */
.answer-list::-webkit-scrollbar {
    width: 6px;
}

.answer-list::-webkit-scrollbar-thumb {
    background-color: rgba(59, 130, 246, 0.45);
    border-radius: 4px;
}

.answer-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(37, 99, 235, 0.65);
}

.answer-list::-webkit-scrollbar-track {
    background: transparent;
}

/* Shared base smooth transitions */
.answer-btn,
.option-item {
    transition: all 0.2s ease-in-out;
    transform-origin: center;
}

/* ===== Hover for YES/NO (answer-btn) ===== */
.answer-btn:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.answer-btn.correct:hover {
    background-color: #1f9f4f;
    box-shadow: 0 5px 14px rgba(34, 197, 94, 0.3);
    transform: translateY(-3px) scale(1.05);
}

/* ===== Hover for MCQ options (option-item) ===== */
.option-item:hover {
    background-color: #e0ecff;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.2);
}

.option-item.correct:hover {
    background: #2fb64a;
    box-shadow: 0 5px 14px rgba(34, 197, 94, 0.3);
    transform: translateY(-3px) scale(1.05);
}

/* ===== Active click feedback ===== */
.answer-btn:active,
.option-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Optional: cursor feedback */
.answer-btn,
.option-item {
    cursor: default;
}

/* ===================== Dimension Gallery Styles ===================== */

/* Error text */
.error-msg {
    color: #b00020;
    text-align: center;
    font-weight: 600;
    margin: 20px 0;
}

.depth-point {
    transition: transform 0.1s ease-out;
}

.depth-point:hover {
    transform: scale(1.3);
    z-index: 2;
}
