/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    background: linear-gradient(to bottom, #2D4046, #111111);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Section Headers */
.section-header {
    position: absolute;
    top: 10vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    width: auto;
    z-index: 10;
}

.section-label {
    height: 50px;
    width: auto;
    filter: invert(1);
    object-fit: contain;
}

/* Video Header Section */
.video-header {
    width: 100vw;
    height: 40vh;
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
}

/* Header Logo */
.header-logo-link {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    transition: transform 0.3s ease;
}

.header-logo-link:hover {
    transform: scale(1.05);
}

.header-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Controls Container */
.controls-container {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
}

/* Overlay Layer Controls */
.overlay-controls {
    flex: 3;
    padding: 20px;
    background-color: rgba(44, 62, 80, 0.8);
    border-radius: 12px;
    border: 1px solid #2c3e50;
}

.video-header video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 3D Model Section */
.model-section {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5vh 0 5vh 0;
    margin: 0;
}

.model-section .section-header {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    margin-bottom: 15px;
    padding: 10px 0;
}

.model-section .section-label {
    height: 70px;
}

/* AB Slider Section */
.ab-slider-section {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 20px 20px 20px;
    margin-top: 0;
}

.ab-slider-section .section-header {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    margin-bottom: 15px;
    padding: 10px 0;
}

.ab-slider-section .section-label {
    height: 70px;
}

.ab-slider-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 720px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: ew-resize;
}

.image-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.slider-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: opacity 0.3s ease;
}

.right-image {
    clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%);
}

.slider-control {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 25;
}

.slider {
    width: 100%;
    height: 100%;
    background: transparent;
    outline: none;
    opacity: 0;
    cursor: ew-resize;
    pointer-events: all;
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 25;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    border: none;
}

.slider::-moz-range-thumb {
    width: 50px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    border: none;
    border-radius: 0;
}

.slider::-moz-range-track {
    background: transparent;
    height: 100%;
    border: none;
}

/* Create a visual slider line and handle */
.slider::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--handle-position, 50%);
    width: 2px;
    background: rgba(0, 0, 0, 0.8);
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
    z-index: 22;
}

/* Add division line on the image container */
.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--handle-position, 50%);
    width: 1px;
    background: rgba(0, 0, 0, 0.9);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 21;
}

/* Add horizontal line across the image */
.slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 20;
}

/* Add the smaller draggable circle with arrows */
.slider-control::after {
    content: '˂  ˃';
    position: absolute;
    top: 50%;
    left: var(--handle-position, 50%);
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    letter-spacing: 1px;
    pointer-events: none;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    z-index: 30;
    /* Remove transition for immediate response */
}

/* Hover effects */
.slider-wrapper:hover .slider-control::after {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Active/dragging state */
.slider-wrapper:active .slider-control::after,
.slider-wrapper.dragging .slider-control::after {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%) scale(1.15);
}

/* Improve line visibility when active */
.slider-wrapper:active .slider::before,
.slider-wrapper.dragging .slider::before {
    background: rgba(0, 0, 0, 1);
    width: 3px;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

.dropdown-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    max-width: 800px;
    gap: 20px;
    margin-bottom: 10px;
}

.dropdown-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.dropdown-wrapper label {
    color: #ecf0f1;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
}

/* Magnification controls when in dropdown area */
.dropdown-controls .magnification-controls {
    flex: 0 0 auto;
    padding: 8px 16px;
    background-color: rgba(52, 73, 94, 0.8);
    border-radius: 12px;
    border: 1px solid #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.image-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #34495e;
    border-radius: 8px;
    background-color: #2c3e50;
    color: #ecf0f1;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.image-select:hover {
    border-color: #3498db;
    background-color: #34495e;
}

.image-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.model-container {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.sketchfab-embed-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.sketchfab-embed-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.sketchfab-embed-wrapper p {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 5px;
    border-radius: 0 0 8px 8px;
    font-size: 10px;
    z-index: 100;
}

/* Overlay layers styling */
.overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    z-index: 15;
    transition: opacity 0.3s ease;
}

/* Overlay Controls - Full Width Standalone */
.overlay-controls {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 15px auto;
    padding: 8px 20px;
    background-color: rgba(44, 62, 80, 0.8);
    border-radius: 12px;
    border: 1px solid #34495e;
}

.overlay-title {
    color: #ecf0f1;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.overlay-toggles {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.1;
    max-width: 800px;
    margin: 0 auto;
}

.overlay-toggle {
    display: flex;
    align-items: center;
    position: relative;
    margin: 0;
    flex: 0 0 auto;
    min-width: 0;
}

.overlay-checkbox {
    display: none;
}

.overlay-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ecf0f1;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
    padding: 1px 3px;
    border-radius: 4px;
    white-space: nowrap;
}

.overlay-label:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

.checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #7f8c8d;
    border-radius: 4px;
    background-color: transparent;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 1px;
    left: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-checkbox:checked + .overlay-label .checkbox-custom {
    background-color: #3498db;
    border-color: #3498db;
}

.overlay-checkbox:checked + .overlay-label .checkbox-custom::after {
    opacity: 1;
}

.overlay-label:hover .checkbox-custom {
    border-color: #3498db;
    transform: scale(1.05);
}

.overlay-checkbox:focus + .overlay-label .checkbox-custom {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Magnification viewer styling */
.magnification-viewer {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    height: 300px;
    border: 3px solid #3498db;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: hidden;
    z-index: 35;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.magnification-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 40;
}

.magnification-crosshair::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
}

.magnification-crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
}

/* Magnification Controls */
.magnification-controls {
    flex: 1;
    padding: 12px 20px;
    background-color: rgba(52, 73, 94, 0.8);
    border-radius: 12px;
    border: 1px solid #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.magnification-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.magnification-checkbox {
    display: none;
}

.magnification-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ecf0f1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
    padding: 3px 6px;
    border-radius: 4px;
}

.magnification-label:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

.magnification-checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #7f8c8d;
    border-radius: 4px;
    background-color: transparent;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.magnification-checkbox-custom::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 1px;
    left: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.magnification-checkbox:checked + .magnification-label .magnification-checkbox-custom {
    background-color: #e74c3c;
    border-color: #e74c3c;
}

.magnification-checkbox:checked + .magnification-label .magnification-checkbox-custom::after {
    opacity: 1;
}

.magnification-label:hover .magnification-checkbox-custom {
    border-color: #e74c3c;
    transform: scale(1.05);
}

.magnification-checkbox:focus + .magnification-label .magnification-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .model-section {
        padding: 3vh 10px 3vh 10px;
        margin-bottom: 0px;
        min-height: 85vh;
    }
    
    .model-section .section-header {
        margin-bottom: 10px;
        padding: 8px 0;
    }
    
    .model-section .section-label {
        height: 60px;
    }
    
    .ab-slider-section {
        padding: 15px 10px 15px 10px;
        margin-top: 0;
    }
    
    .ab-slider-section .section-header {
        margin-bottom: 10px;
        padding: 8px 0;
    }
    
    .ab-slider-section .section-label {
        height: 60px;
    }
    
    .section-header {
        top: 8vh;
        padding: 15px 0;
    }
    
    .section-label {
        height: 45px;
        filter: invert(1);
    }

    /* Header logo responsive */
    .header-logo-link {
        top: 15px;
        right: 15px;
    }
    
    .header-logo {
        height: 45px;
    }
    
    .sketchfab-embed-wrapper p {
        font-size: 11px !important;
    }
    
    .slider-wrapper {
        height: 480px;
    }
    
    .dropdown-controls {
        flex-direction: column;
        gap: 15px;
        max-width: 400px;
        align-items: center;
    }
    
    .dropdown-controls .magnification-controls {
        order: 3;
        margin-top: 10px;
    }
    
    .dropdown-wrapper label {
        font-size: 14px;
    }
    
    .image-select {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .overlay-controls {
        padding: 6px 15px;
    }
    
    .overlay-title {
        font-size: 15px;
        margin-bottom: 4px;
    }
    
    .overlay-toggles {
        gap: 6px;
    }
    
    .overlay-label {
        font-size: 11px;
        padding: 1px 2px;
    }
    
    .checkbox-custom {
        width: 16px;
        height: 16px;
    }
    
    .checkbox-custom::after {
        width: 5px;
        height: 8px;
        left: 4px;
    }
    
    .magnification-controls {
        padding: 15px;
    }
    
    .magnification-label {
        font-size: 14px;
    }
    
    .magnification-checkbox-custom {
        width: 18px;
        height: 18px;
    }
    
    .magnification-checkbox-custom::after {
        width: 6px;
        height: 10px;
        left: 5px;
    }
}

@media (max-width: 480px) {
    .video-header {
        height: 35vh;
    }
    
    .model-section {
        height: 100vh;
        padding: 2vh 5px 2vh 5px;
        margin: 0;
    }
    
    .model-section .section-header {
        margin-bottom: 8px;
        padding: 5px 0;
    }
    
    .model-section .section-label {
        height: 50px;
    }
    
    .ab-slider-section {
        padding: 10px 5px 10px 5px;
        margin-top: 0;
    }
    
    .ab-slider-section .section-header {
        margin-bottom: 8px;
        padding: 5px 0;
    }
    
    .ab-slider-section .section-label {
        height: 50px;
    }
    
    .section-header {
        top: 6vh;
        padding: 12px 0;
    }
    
    .section-label {
        height: 40px;
        filter: invert(1);
    }

    /* Header logo mobile responsive */
    .header-logo-link {
        top: 10px;
        right: 10px;
    }
    
    .header-logo {
        height: 35px;
    }
    
    .slider-wrapper {
        height: 360px;
    }
    
    .overlay-toggles {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .overlay-controls {
        padding: 6px 12px;
    }
    
    .magnification-controls {
        padding: 8px 12px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}
