@import url('https://fonts.googleapis.com/css?family=Comfortaa');

/* Cache les éléments avant que model-viewer soit chargé */
:not(:defined)>* {
    display: none;
}

/* Reset global */
body {
    margin: 0;
    padding: 0;
    background-color: #fefefe;
    font-family: 'Comfortaa', sans-serif;
    font-weight: 300;
    font-size: 14px;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Sidebar (desktop) */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(100%);
}

/* Contenu de la sidebar */
.sidebar-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
    text-align: center;
}

.sidebar-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.sidebar-content p {
    font-size: 14px;
    margin-bottom: 20px;
}

.sidebar-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.9;
}

.sidebar-button:hover {
    background-color: #3267d6;
}

/* Model Viewer (desktop) */
model-viewer {
    width: calc(100vw - 300px);
    height: 100vh;
    position: absolute;
    left: 0;
    top: 0;
    transition: all 0.3s ease;
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Sidebar fermée */
.sidebar.collapsed ~ model-viewer {
    width: 100vw !important;
    height: 100vh !important;
}

/* Bouton Toggle */
.toggle-button {
    position: absolute;
    left: -38px;
    top: 50%;
    transform: translateY(-50%);
    height: 100px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101;
}

.toggle-icon {
    width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

/* Barre de chargement */
.progress-bar {
    display: block;
    width: 33%;
    height: 2%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 25px;
    box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5), 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    background-color: rgba(0, 0, 0, 0.5);
}

.progress-bar.hide {
    visibility: hidden;
    transition: visibility 0.3s;
}

.update-bar {
    background-color: rgba(255, 255, 255, 0.9);
    width: 0%;
    height: 100%;
    border-radius: 25px;
    float: left;
    transition: width 0.3s;
}

/* Boutons AR / Site */
#ar-button,
#aryouready,
#trigger-ar,
#website {
    height: 36px;
    line-height: 36px;
    background-image: url('../img/ar_icon.png');
    background-repeat: no-repeat;
    background-size: 20px 20px;
    background-position: 12px 50%;
    background-color: #fff;
    white-space: nowrap;
    padding: 0px 16px 0px 40px;
    font-family: Roboto Regular, Helvetica Neue, sans-serif;
    font-size: 14px;
    color: #4285f4;
    border-radius: 18px;
    border: 1px solid #DADCE0;
    cursor: pointer;
    z-index: 11;
    margin-bottom: 10px;
    max-width: 180px;
}

#ar-button {
    display: none;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 1em;
}

.button-group button {
    flex: 1 1 auto;
    min-width: 120px;
}

a {
    text-decoration: none;
}

button#website {
    background-image: url('../img/web_icon.png');
}

#ar-button:active {
    background-color: #E8EAED;
}

#ar-button:focus {
    outline: none;
}

#ar-button:focus-visible {
    outline: 1px solid #4285f4;
}

/* QR Code Info */
div#infosAr {
    text-align: center;
    font-weight: bold;
    padding: 20px;
}

div#infosAr div#info {
    margin-top: 10px;
    font-weight: normal;
    font-style: italic;
    font-size: 11px;
}

div#infosAr div#subinfo {
    margin-top: 10px;
    font-weight: normal;
    font-size: 10px;
    display: none;
}

/* ----- MOBILE RESPONSIVE ----- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        width: 100vw;
        height: 250px;
        top: auto;
        bottom: 0;
        right: 0;
        padding: 10px 0;
        transform: translateY(0);
        transition: transform 0.3s ease;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
    }

    .sidebar-content {
        justify-content: start;
    }

    .sidebar.collapsed {
        transform: translateY(100%);
    }

    .toggle-button {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 265px;
        top: auto;
        height: 40px;
        z-index: 101;
    }

    model-viewer {
        width: 100vw;
        height: calc(100vh - 200px);
    }

    .sidebar.collapsed ~ model-viewer {
        height: 100vh !important;
    }
}

/* ----- MOBILE RESPONSIVE ----- */
@media (max-width: 369px) {
    .sidebar {
        position: fixed;
        width: 100vw;
        height: 350px;
        top: auto;
        bottom: 0;
        right: 0;
        padding: 10px 0;
        transform: translateY(0);
        transition: transform 0.3s ease;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
    }

    .sidebar-content {
        justify-content: start;
    }

    .sidebar.collapsed {
        transform: translateY(100%);
    }

    .toggle-button {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 365px;
        top: auto;
        height: 40px;
        z-index: 101;
    }

    model-viewer {
        width: 100vw;
        height: calc(100vh - 200px);
    }

    .sidebar.collapsed ~ model-viewer {
        height: 100vh !important;
    }
}

