/**
 * viewer.css — Styles du module mod_viewer3d
 * © 2025 Anwynn — anwynn@laposte.net — anwynn.be
 */

/* ── Conteneur principal ───────────────────────────────────────────────────── */
.mod-viewer3d { position: relative; width: 100%; }

.mod-viewer3d-title {
    margin: 0 0 0.5em;
    font-size: 1.1rem;
    font-weight: 400;
}

.mod-viewer3d-wrap {
    position: relative;
    display: flex;
    overflow: hidden;
    background: #191919;
    border-radius: 4px;
}

/* ── Panneau latéral ───────────────────────────────────────────────────────── */
.mv3d-panel {
    width: 220px;
    flex-shrink: 0;
    background: #222;
    display: flex;
    flex-direction: column;
    z-index: 5;
}

.mv3d-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6em 0.8em;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    flex-shrink: 0;
}

.mv3d-btn-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 0.2em;
    transition: color 0.2s;
}
.mv3d-btn-close:hover { color: #ccc; }

.mv3d-model-list {
    list-style: none;
    margin: 0;
    padding: 0.3em 0;
    overflow-y: auto;
    flex-grow: 1;
}

.mv3d-model-item {
    display: flex;
    flex-direction: column;
    padding: 0.55em 0.8em;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.mv3d-model-item:hover  { background: #2d2d2d; }
.mv3d-model-item.active { background: #1e2d3d; border-left-color: #7eb8f7; }

.mv3d-name { font-size: 0.82rem; color: #ddd; word-break: break-all; }
.mv3d-size { font-size: 0.7rem; color: #666; margin-top: 0.1em; }

.mv3d-loading, .mv3d-empty {
    padding: 1em;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    list-style: none;
}

/* Bouton ré-afficher le panneau */
.mv3d-btn-show {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: #2a2a2a;
    border: 1px solid #444;
    border-left: none;
    color: #ccc;
    font-size: 0.75rem;
    padding: 0.7em 0.4em;
    cursor: pointer;
    writing-mode: vertical-lr;
    border-radius: 0 4px 4px 0;
    transition: background 0.2s;
}
.mv3d-btn-show:hover { background: #383838; }

/* ── Dropdown ──────────────────────────────────────────────────────────────── */
.mv3d-dropdown-wrap {
    position: absolute;
    top: 0.5em;
    left: 0.5em;
    z-index: 10;
}

.mv3d-select {
    background: #2a2a2a;
    color: #ddd;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.4em 0.6em;
    font-size: 0.85rem;
    cursor: pointer;
    max-width: 200px;
}

/* ── Colonne viewer (zone 3D + commentaire) ────────────────────────────────── */
.mv3d-viewer-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Zone viewer ───────────────────────────────────────────────────────────── */
.mv3d-viewer-zone {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

.mv3d-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mv3d-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.9rem;
    text-align: center;
    padding: 2em;
    font-family: sans-serif;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
}

/* Reprise des styles axes depuis le viewer standalone */
.axes {
    width: 80px;
    height: 80px;
    margin: 12px;
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
}

/* ── Bouton plein écran ────────────────────────────────────────────────────── */
.mv3d-btn-fullscreen {
    position: absolute;
    bottom: 0.5em;
    right: 0.5em;
    z-index: 20;
    background: rgba(40,40,40,0.85);
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    padding: 0.35em 0.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}
.mv3d-btn-fullscreen:hover { background: #444; color: #fff; }

/* Colonne viewer en plein écran */
.mv3d-viewer-col.mv3d-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
}

/* ── Bouton réglages ───────────────────────────────────────────────────────── */
.mv3d-btn-settings {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    z-index: 20;
    background: rgba(40,40,40,0.85);
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    padding: 0.3em 0.5em;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}
.mv3d-btn-settings:hover { background: #444; color: #fff; }

/* ── Cercle de chargement ──────────────────────────────────────────────────── */
.mv3d-loading-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.mv3d-loading-circle svg {
    position: absolute;
    top: 0; left: 0;
    width: 140px; height: 140px;
}

.mv3d-loading-circle .lc-track {
    fill: none;
    stroke: #2e2e2e;
    stroke-width: 5;
}

.mv3d-loading-circle .lc-arc {
    fill: none;
    stroke: #4caf82;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 110 330;
    animation: mv3d-rotate 1.2s linear infinite;
    transform-origin: 80px 80px;
}

.mv3d-loading-circle .lc-time {
    position: relative;
    z-index: 1;
    font-family: sans-serif;
    font-size: 1.3rem;
    font-weight: 300;
    color: #4caf82;
    font-variant-numeric: tabular-nums;
}

@keyframes mv3d-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mv3d-panel { display: none !important; }
    .mv3d-dropdown-wrap { display: block !important; }
}

/* ── Commentaire modèle ────────────────────────────────────────────────────── */
.mv3d-comment-wrap {
    flex-shrink: 0;
    text-align: center;
    padding: 0.55em 1em;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
}

/* ── Interaction hint (main animée) ────────────────────────────────────────── */
.mv3d-interaction-hint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.mv3d-hint-hand {
    width: 25px;
    height: 36px;
    opacity: 0;
    /* La position X et l'opacité sont pilotées intégralement par JS */
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
    will-change: transform, opacity;
}
