/* ---------- RESET / GLOBAL ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- TOP BAR ---------- */
.top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #2d2d2d;
    flex-wrap: wrap;
    border-bottom: 3px solid #f57c00;
}
.logo {
    font-weight: bold;
    font-size: 20px;
    color: #f57c00;
    cursor: pointer;
    user-select: none;
}
.logo:hover {
    opacity: 0.8;
}
#searchField {
    flex: 2;
    min-width: 180px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    background: #3d3d3d;
    color: #fff;
}
#searchField::placeholder {
    color: #888;
}
#searchField:focus {
    outline: 2px solid #f57c00;
    background: #4d4d4d;
}
.module-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 180px;
}
#moduleInput {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    background: #3d3d3d;
    color: #fff;
}
#moduleInput::placeholder {
    color: #888;
}
#moduleInput:focus {
    outline: 2px solid #f57c00;
    background: #4d4d4d;
}
.module-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #3d3d3d;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    border: 1px solid #555;
    border-top: none;
}
.module-dropdown.show {
    display: block;
}
.module-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    color: #ddd;
}
.module-dropdown-item:hover {
    background: #f57c00;
    color: #fff;
}

/* ---------- BACK BUTTON BAR ---------- */
.back-bar {
    padding: 12px 20px 0 20px;
    background: #e8e8e8;
    display: none;
}
.back-bar button {
    width: 100%;
    padding: 8px 15px;
    background: #f57c00;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}
.back-bar button:hover {
    background: #e65100;
}

/* ---------- MAIN CONTENT ---------- */
main {
    flex: 1;
    padding: 20px;
    background: #e8e8e8;
    overflow-y: auto;
}
.results-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.info-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ---------- RESULT CARDS ---------- */
.result-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid #f57c00;
}
.result-card:hover {
    background: #f5f5f5;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.2);
}
.result-card .question {
    font-size: 14px;
    color: #2d2d2d;
}

/* ---------- INFO CARDS ---------- */
.info-module-title {
    font-size: 20px;
    font-weight: bold;
    color: #2d2d2d;
    border-bottom: 2px solid #f57c00;
    padding-bottom: 8px;
}
.info-question {
    font-size: 16px;
    font-weight: bold;
    color: #2d2d2d;
    word-wrap: break-word;
}
.info-separator {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 5px 0;
}

/* Add to style.css - better text formatting */
.info-card .info-text {
    font-size: 14px;
    color: #2d2d2d;
    word-wrap: break-word;
    line-height: 1.8;
    margin: 0;
    white-space: pre-wrap;
}

.info-card .info-text br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Better list formatting */
.info-card .info-text {
    padding-left: 8px;
}

.info-card .info-text strong {
    color: #f57c00;
}

/* Improve textarea display */
.info-textarea {
    width: 100%;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: Consolas, monospace;
    font-size: 13px;
    color: #2d2d2d;
    resize: vertical;
    min-height: 60px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Carousel */
.carousel-scroll {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}
.carousel-scroll::-webkit-scrollbar {
    height: 8px;
}
.carousel-scroll::-webkit-scrollbar-track {
    background: #e8e8e8;
    border-radius: 4px;
}
.carousel-scroll::-webkit-scrollbar-thumb {
    background: #f57c00;
    border-radius: 4px;
}
.carousel-scroll::-webkit-scrollbar-thumb:hover {
    background: #e65100;
}
.carousel-item {
    flex: 0 0 auto;
    width: 280px;
    scroll-snap-align: start;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #ddd;
    transition: transform 0.3s, box-shadow 0.3s;
}
.carousel-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.2);
}
.carousel-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid #f57c00;
    transition: border-color 0.3s;
}
.carousel-item img:hover {
    border-color: #e65100;
}
.carousel-item .caption {
    font-size: 11px;
    color: #555;
    margin-top: 4px;
    word-wrap: break-word;
}

/* TextArea */
.info-textarea {
    width: 100%;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: Consolas, monospace;
    font-size: 13px;
    color: #2d2d2d;
    resize: vertical;
    min-height: 60px;
}
.info-textarea:focus {
    outline: 2px solid #f57c00;
}

/* ---------- ZOOM OVERLAY ---------- */
/* ---------- IMAGE CONTAINER - Responsive ---------- */
.image-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f8f8;
    border-radius: 4px;
    padding: 5px;
    min-height: 100px;
}

.info-card .info-image {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid #f57c00;
    transition: border-color 0.3s, opacity 0.3s;
    display: block;
}

.info-card .info-image:hover {
    border-color: #e65100;
    opacity: 0.95;
}

/* Responsive image sizes */
@media (max-width: 768px) {
    .info-card .info-image {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .info-card .info-image {
        max-height: 200px;
    }
}

/* ---------- ZOOM OVERLAY - Improved ---------- */
.zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.zoom-content {
    position: relative;
    width: 95vw;
    height: 95vh;
    display: flex;
    flex-direction: column;
    cursor: default;
}

.zoom-close {
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.3s;
    font-weight: bold;
}

.zoom-close:hover {
    color: #f57c00;
}

.zoom-image-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 8px;
    border: 2px solid #f57c00;
    position: relative;
    cursor: grab;
}

.zoom-image-wrapper:active {
    cursor: grabbing;
}

.zoom-image-wrapper img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    transition: none;
    will-change: transform;
}

.zoom-image-wrapper img:active {
    cursor: grabbing;
}

.zoom-instructions {
    color: #fff;
    font-size: 13px;
    opacity: 0.7;
    text-align: center;
    padding: 10px 0 5px 0;
    user-select: none;
    font-family: Arial, sans-serif;
}

@media (max-width: 768px) {
    .zoom-content {
        width: 98vw;
        height: 98vh;
    }
    
    .zoom-image-wrapper img {
        max-width: 95%;
        max-height: 80vh;
    }
    
    .zoom-close {
        top: 5px;
        right: 15px;
        font-size: 32px;
    }
}

/* ---------- HELPERS ---------- */
.hidden {
    display: none !important;
}
.instruction-text {
    font-size: 14px;
    color: #555;
}
.error-text {
    font-size: 14px;
    color: #d32f2f;
}

/* ---------- SCROLLBAR STYLING ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #e8e8e8;
}
::-webkit-scrollbar-thumb {
    background: #f57c00;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #e65100;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #searchField,
    .module-select-wrapper {
        min-width: auto;
    }
    .back-bar {
        padding: 8px 10px 0 10px;
    }
    main {
        padding: 10px;
    }
    .carousel-item {
        width: 200px;
    }
    .carousel-item img {
        height: 140px;
    }
    .info-card .info-image {
        max-height: 200px;
    }
}

