/* General Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: #f4f4f9; /* Clean, neutral background */
    color: #333; /* Dark text for good contrast */
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent overflowing on small screens */
}

/* Style for the model-viewer container */
model-viewer {
    background-color: #eee; /* Clean light-gray background */
    border-radius: 12px; /* Soft-rounded corners */
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); /* Subtle drop shadow */
    width: 90%; /* Adjust dynamically to the viewport */
    max-width: 800px; /* Limit max size */
    height: 60%; /* Proportional height */
    overflow: hidden; /* Prevents overflow content */
    display: block; /* Centered block layout */
}

/* Progress bar inside the model-viewer */
.progress-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 8px;
    background-color: #ccc; /* Light gray background */
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: none; /* Start hidden */
}

.progress-bar.show {
    display: block; /* Display dynamically */
}

.update-bar {
    width: 0;
    height: 100%;
    background-color: #4285f4; /* Blue progress for emphasis */
    transition: width 0.3s;
}

/* Prompt styles inside the model-viewer */
#ar-prompt {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fade-in 1s ease-in-out;
}

#ar-prompt img {
    width: 24px;
    height: 24px;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Styles for the AR button */
#ar-button {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4285f4;
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#ar-button:hover {
    transform: translateX(-50%) scale(1.1); /* Enlarge slightly */
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);
}

#ar-button:active {
    background-color: #357ae8; /* Adjust active color */
}

/* Slider styles */
.slider {
    position: absolute;
    bottom: 16px;
    width: calc(100% - 20px);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.slides {
    display: flex;
    gap: 12px;
}

.slide {
    width: 80px;
    height: 80px;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

.slide:hover {
    transform: scale(1.1);
    box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.4);
}

.slide.selected {
    border: 2px solid #4285f4;
    transform: scale(1.1);
}

/* Responsive Design Adjustments */
@media (max-width: 768px) {
    model-viewer {
        height: 50%; /* Reduce height for smaller screens */
        max-width: 90%; /* Adjust content scaling */
    }

    #ar-button {
        bottom: 100px; /* Adjust spacing for smaller screens */
        font-size: 12px;
    }

    .slide {
        width: 60px;
        height: 60px;
    }

    .slider {
        gap: 8px;
    }
}

/* Viewer container styles */
#viewer-container {
    width: 100%;
    height: 80vh; /* Use 80% of viewport height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: 0 auto;
    max-width: 1200px;
    padding: 20px;
}

/* Ensure model-viewer fills the container appropriately */
#viewer-container model-viewer {
    width: 100%;
    height: 100%;
    min-height: 400px;
    margin: 0 auto;
    position: relative;
    background-color: #f8f8f8;
    --poster-color: transparent;
}

/* Position the slider at the bottom of the container instead of absolutely on the page */
#viewer-container .slider {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 90%;
    max-width: 800px;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #viewer-container {
        height: 70vh;
        padding: 10px;
    }

    #viewer-container model-viewer {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    #viewer-container {
        height: 60vh;
    }

    #viewer-container model-viewer {
        min-height: 250px;
    }
}