@font-face {
    font-family: "Lato";
    src: url("https://www.carmax.com/shared/fonts/lato-v16-latin-regular.woff2") format("woff2");
    font-display: swap;
    font-weight: 400;
}

@font-face {
    font-family: "Lato";
    src: url("https://www.carmax.com/shared/fonts/lato-v16-latin-700.woff2") format("woff2");
    font-display: swap;
    font-weight: 700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    color: #2a343d;
    font-family: "Lato", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
}

.container {
    max-width: 900px;
    width: 100%;
}

.viewer-wrapper {
    background: white;
    border-radius: 12px;
    padding: 24px;
}

.viewer-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: #f5f6f7;
    border-radius: 12px;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* A-Frame panorama sizing inside the viewer box */
.viewer-container a-scene,
.viewer-container .a-canvas {
    width: 100% !important;
    height: 450px !important;
    display: block;
}

.viewer-container:active {
    cursor: grabbing;
}

.viewer-image {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 8px rgba(42, 52, 61, 0.18);
    color: #2a343d;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 10;
}

.loading-indicator.hidden {
    display: none;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #005ab8;
    color: white;
    border: 1px solid #005ab8;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    font-weight: 700;
}

.control-btn:hover:not(:disabled) {
    background: #00264f;
    border-color: #00264f;
}

#pause-btn,
#interior-link,
#exterior-link {
    background: white;
    color: #005ab8;
}

#pause-btn:hover:not(:disabled),
#interior-link:hover,
#exterior-link:hover {
    background: #f0f7fc;
    border-color: #00264f;
    color: #00264f;
}

.control-btn:disabled {
    background: #f5f6f7;
    border-color: #dedfe0;
    color: #6b7178;
    cursor: not-allowed;
}

.frame-slider {
    flex: 1;
    min-width: 200px;
    height: 4px;
    border-radius: 2px;
    background: #dedfe0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.frame-slider:focus-visible {
    outline: 2px solid #005ab8;
    outline-offset: 4px;
}

.frame-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #005ab8;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.frame-slider::-webkit-slider-thumb:hover {
    background: #00264f;
}

.frame-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #005ab8;
    cursor: pointer;
    border: none;
    transition: background-color 0.15s ease;
}

.frame-slider::-moz-range-thumb:hover {
    background: #00264f;
}

.frame-counter {
    font-size: 0.875rem;
    font-weight: 700;
    color: #565d65;
    min-width: 100px;
    text-align: right;
}

.instructions {
    margin-top: 12px;
    text-align: center;
}

.viewer-footer {
    margin-top: 20px;
    text-align: center;
    color: #f0f0f0;
    font-size: 0.9rem;
}

.instructions p {
    color: #565d65;
    font-size: 0.875rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .viewer-wrapper {
        padding: 12px;
    }

    .controls {
        gap: 8px;
    }

    .frame-counter {
        flex: 1 1 100%;
        text-align: center;
    }

    .control-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 8px;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .frame-slider {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* Touch devices (phones/tablets) keep the stacked layout */
@media (max-width: 768px) and (pointer: coarse) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-btn {
        flex: none;
        width: 100%;
        padding: 0 24px;
        font-size: 1rem;
    }

    .frame-slider {
        flex: none;
    }

    .frame-counter {
        flex: none;
    }
}

/* Link button styles */
#interior-link,
#exterior-link {
    text-decoration: none;
    text-align: center;
}
