/* ================================================================
   ROOM VIEW — CSS PUBLIC
   Chemin: public/modules/room-view/css/room-view.css
   ================================================================ */

/* ================================================================
   1. OVERLAY PLEIN ÉCRAN
   ================================================================ */
.rv-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: #F8F9FA;
    z-index: 50000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rv-overlay.rv-open {
    display: flex;
}

/* ================================================================
   2. HEADER
   ================================================================ */
.rv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 20px;
    background-color: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
    z-index: 10;
}

.rv-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rv-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.rv-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rv-header-title {
    font-size: 16px;
    font-weight: 700;
    color: #4A5568;
    margin: 0;
}

.rv-back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4A5568;
    transition: background-color 0.2s;
}

.rv-back-btn:hover {
    background-color: #EEF1F5;
}

.rv-back-btn i {
    width: 20px;
    height: 20px;
}

.rv-header-action {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4A5568;
    transition: background-color 0.2s;
}

.rv-header-action:hover {
    background-color: #EEF1F5;
}

.rv-header-action i {
    width: 20px;
    height: 20px;
}

.rv-close-btn:hover {
    background-color: rgba(229, 115, 115, 0.1);
    color: #E57373;
}

.rv-dimensions-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    background-color: rgba(107, 158, 206, 0.1);
    color: #6B9ECE;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ================================================================
   3. ÉCRANS (navigation entre vues)
   ================================================================ */
.rv-screen {
    display: none;
    flex: 1;
    overflow: hidden;
}

.rv-screen-active {
    display: flex;
    flex-direction: column;
}

/* ================================================================
   4. ÉCRAN TEMPLATES (sélection de pièce)
   ================================================================ */
#rvScreenTemplates {
    overflow-y: auto;
    padding: 24px;
}

.rv-templates-intro {
    text-align: center;
    margin-bottom: 20px;
}

.rv-templates-subtitle {
    color: #718096;
    font-size: 15px;
    margin: 0;
}

/* Onglets catégories */
.rv-categories-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
}

.rv-cat-tab {
    padding: 8px 18px;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    background-color: #FFFFFF;
    color: #4A5568;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rv-cat-tab:hover {
    border-color: #6B9ECE;
    color: #6B9ECE;
}

.rv-cat-tab-active {
    background-color: #6B9ECE;
    border-color: #6B9ECE;
    color: #FFFFFF;
}

/* Grille de templates */
.rv-templates-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.rv-tpl-card {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background-color: #FFFFFF;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.rv-tpl-card:hover {
    border-color: #6B9ECE;
    box-shadow: 0 4px 16px rgba(107, 158, 206, 0.2);
    transform: translateY(-2px);
}

.rv-tpl-card-img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
}

.rv-tpl-card-info {
    padding: 10px 14px;
}

.rv-tpl-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
    margin: 0;
}

.rv-tpl-card-cat {
    font-size: 11px;
    color: #A0AEC0;
    margin-top: 2px;
}

/* Entrée mur personnalisé */
.rv-custom-wall-entry {
    text-align: center;
    margin-bottom: 24px;
}

.rv-custom-wall-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border: 2px solid #6B9ECE;
    border-radius: 12px;
    background-color: rgba(107, 158, 206, 0.06);
    color: #6B9ECE;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rv-custom-wall-btn:hover {
    border-color: #6B9ECE;
    color: #6B9ECE;
    background-color: rgba(107, 158, 206, 0.04);
}

.rv-custom-wall-btn i {
    width: 20px;
    height: 20px;
}

/* ================================================================
   5. ÉCRAN PRINCIPAL (visualisation)
   ================================================================ */
.rv-main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* === SIDEBAR === */
.rv-sidebar {
    width: 320px;
    background-color: #FFFFFF;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

/* Photo sélectionnée */
.rv-selected-photo {
    padding: 12px;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.rv-selected-photo img {
    width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
    background-color: #F7FAFC;
}

/* Onglets sidebar */
.rv-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.rv-sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #A0AEC0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.rv-sidebar-tab:hover {
    color: #4A5568;
}

.rv-sidebar-tab-active {
    color: #6B9ECE;
    border-bottom-color: #6B9ECE;
}

.rv-sidebar-tab i {
    width: 16px;
    height: 16px;
}

/* Panneaux sidebar */
.rv-sidebar-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.rv-sidebar-panel-active {
    display: block;
}

/* --- Liste produits --- */
.rv-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
    border: 2px solid transparent;
    margin-bottom: 4px;
}

.rv-product-item:hover {
    background-color: #F7FAFC;
}

.rv-product-item-active {
    background-color: rgba(107, 158, 206, 0.06);
    border-color: #6B9ECE;
}

.rv-product-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background-color: #EEF1F5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rv-product-icon i {
    width: 20px;
    height: 20px;
    color: #718096;
}

.rv-product-info {
    flex: 1;
    min-width: 0;
}

.rv-product-name {
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-product-size {
    font-size: 11px;
    color: #A0AEC0;
    margin-top: 1px;
}

.rv-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #6B9ECE;
    flex-shrink: 0;
}

/* --- Modale sélection collection --- */
.rv-collection-modal {
    z-index: 10000;
}

.rv-collection-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.rv-collection-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #EDF2F7;
}

.rv-collection-modal-header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rv-collection-title {
    font-size: 15px;
    font-weight: 600;
    color: #2D3748;
}

.rv-collection-counter {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #6B9ECE;
    padding: 2px 10px;
    border-radius: 12px;
}

.rv-collection-counter.rv-collection-complete {
    background: #7EC8A3;
}

.rv-collection-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #A0AEC0;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}

.rv-collection-modal-close:hover {
    background: #F7FAFC;
    color: #E53E3E;
}

.rv-collection-description {
    font-size: 12px;
    color: #718096;
    padding: 10px 20px;
    line-height: 1.4;
}

.rv-collection-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 0 20px 16px;
    overflow-y: auto;
    flex: 1;
}

.rv-collection-thumb {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.15s;
}

.rv-collection-thumb:hover {
    border-color: #CBD5E0;
    transform: scale(1.03);
}

.rv-collection-thumb.rv-collection-thumb-selected {
    border-color: #6B9ECE;
    box-shadow: 0 0 0 2px rgba(107, 158, 206, 0.3);
}

.rv-collection-thumb.rv-collection-thumb-selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: #6B9ECE;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.rv-collection-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rv-collection-thumb.rv-collection-thumb-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.rv-collection-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #EDF2F7;
}

.rv-collection-modal-footer .rv-btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Croix suppression photo placée --- */
.rv-placed-photo-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #E53E3E;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    z-index: 100;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.rv-placed-photo-remove:hover {
    background: #C53030;
    transform: scale(1.15);
}

/* --- Liste cadres --- */
.rv-frame-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
    border: 2px solid transparent;
    margin-bottom: 4px;
}

.rv-frame-item:hover {
    background-color: #F7FAFC;
}

.rv-frame-item-active {
    background-color: rgba(107, 158, 206, 0.06);
    border-color: #6B9ECE;
}

/* Cadre proposé pour la projection seule : mention à la place du prix.
   Discrète — c'est une précision, pas un avertissement. */
.rv-frame-preview-tag {
    margin-left: auto;
    font-size: 11px;
    font-style: italic;
    color: #718096;
    white-space: nowrap;
}

.rv-frame-swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.rv-frame-none {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F7FAFC;
}

.rv-frame-none i {
    width: 16px;
    height: 16px;
    color: #A0AEC0;
}

.rv-frame-item span {
    font-size: 13px;
    font-weight: 500;
    color: #4A5568;
}

/* --- Passe-partout --- */
.rv-mat-section {
    padding: 12px;
    border-top: 1px solid #E2E8F0;
    margin-top: 8px;
}

.rv-mat-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
}

/* Toggle petit format */
.rv-toggle-sm {
    position: relative;
    width: 36px;
    height: 20px;
    display: inline-block;
}

.rv-toggle-sm input {
    opacity: 0;
    width: 0;
    height: 0;
}

.rv-toggle-slider-sm {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CBD5E0;
    border-radius: 20px;
    transition: 0.25s;
}

.rv-toggle-slider-sm:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #FFFFFF;
    border-radius: 50%;
    transition: 0.25s;
}

.rv-toggle-sm input:checked + .rv-toggle-slider-sm {
    background-color: #6B9ECE;
}

.rv-toggle-sm input:checked + .rv-toggle-slider-sm:before {
    transform: translateX(16px);
}

.rv-mat-options {
    margin-top: 12px;
}

.rv-mat-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.rv-mat-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.rv-mat-color-btn:hover {
    transform: scale(1.1);
}

.rv-mat-color-btn-active {
    border-color: #6B9ECE;
    box-shadow: 0 0 0 2px rgba(107, 158, 206, 0.3);
}

.rv-mat-width {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rv-mat-width label {
    font-size: 12px;
    color: #718096;
    white-space: nowrap;
}

.rv-mat-width input[type="range"] {
    flex: 1;
    accent-color: #6B9ECE;
    height: 4px;
}

.rv-mat-width span {
    font-size: 12px;
    font-weight: 600;
    color: #4A5568;
    min-width: 40px;
    text-align: right;
}

/* --- Footer sidebar (bouton panier) --- */
.rv-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #E2E8F0;
    flex-shrink: 0;
}

/* Note affichée quand le cadre choisi n'est pas vendu : l'achat reste
   possible, le tirage part sans cadre. */
.rv-frame-preview-note {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background-color: #F8F9FA;
    border: 1px solid #E2E8F0;
    color: #718096;
    font-size: 12px;
    line-height: 1.4;
}

.rv-add-to-cart-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background-color: #6B9ECE;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rv-add-to-cart-btn:hover:not(:disabled) {
    background-color: #5A8AB5;
    box-shadow: 0 2px 8px rgba(107, 158, 206, 0.35);
}

.rv-add-to-cart-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rv-add-to-cart-btn i {
    width: 18px;
    height: 18px;
}

/* ================================================================
   6. VIEWPORT (zone de visualisation centrale)
   ================================================================ */
.rv-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: #E8ECEF;
}

.rv-render-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rv-template-bg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Zone d'accrochage */
.rv-hanging-zone {
    position: absolute;
    /* Positionnée dynamiquement par JS selon le template */
}

/* Photo placée sur le mur (mode CSS) */
.rv-placed-photo {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.rv-placed-photo:active {
    cursor: grabbing;
}

.rv-placed-photo-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.rv-placed-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ombre de la photo sur le mur */
.rv-placed-photo-shadow {
    box-shadow: 4px 6px 20px rgba(0, 0, 0, 0.25),
                2px 2px 6px rgba(0, 0, 0, 0.1);
}

/* Dimensions overlay */
.rv-placed-photo-dims {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

/* Indicateur de sélection (photo active) */
.rv-placed-photo-selected {
    outline: 2px solid #6B9ECE;
    outline-offset: 2px;
}

.rv-placed-photo-handles {
    display: none;
}

.rv-placed-photo-selected .rv-placed-photo-handles {
    display: block;
}

/* Poignées de redimensionnement */
.rv-resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #6B9ECE;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 5;
    flex-shrink: 0;
}

.rv-resize-handle-br {
    bottom: -6px;
    right: -6px;
}

.rv-resize-handle-bl {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

/* Canvas Three.js */
#rvThreeCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Loading scène */
.rv-scene-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(248, 249, 250, 0.9);
    z-index: 5;
}

/* ================================================================
   7. TOOLBAR (barre d'outils en bas)
   ================================================================ */
.rv-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.rv-tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background-color: transparent;
    color: #4A5568;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rv-tool-btn:hover {
    border-color: #6B9ECE;
    color: #6B9ECE;
    background-color: rgba(107, 158, 206, 0.04);
}

.rv-tool-btn i {
    width: 16px;
    height: 16px;
}

/* ================================================================
   8. ÉCRAN UPLOAD MUR PERSONNEL
   ================================================================ */
#rvScreenUpload {
    overflow-y: auto;
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.rv-upload-container {
    max-width: 600px;
    width: 100%;
}

.rv-upload-card {
    background-color: #FFFFFF;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rv-upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background-color: rgba(107, 158, 206, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rv-upload-icon i {
    width: 32px;
    height: 32px;
    color: #6B9ECE;
}

.rv-upload-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #4A5568;
    margin: 0 0 8px;
}

.rv-upload-card > p {
    font-size: 14px;
    color: #718096;
    margin: 0 0 24px;
}

.rv-upload-dropzone {
    padding: 40px 20px;
    border: 2px dashed #CBD5E0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
}

.rv-upload-dropzone:hover,
.rv-upload-dropzone.rv-dragover {
    border-color: #6B9ECE;
    background-color: rgba(107, 158, 206, 0.04);
}

.rv-upload-dropzone i {
    width: 40px;
    height: 40px;
    color: #A0AEC0;
    margin-bottom: 10px;
}

.rv-upload-dropzone p {
    font-size: 14px;
    color: #4A5568;
    font-weight: 500;
    margin: 0 0 4px;
}

.rv-upload-dropzone small {
    font-size: 12px;
    color: #A0AEC0;
}

.rv-upload-preview {
    margin-top: 20px;
}

.rv-upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}

.rv-upload-error {
    margin-top: 16px;
    padding: 10px 16px;
    background-color: rgba(229, 115, 115, 0.1);
    color: #C53030;
    border-radius: 8px;
    font-size: 13px;
}

.rv-upload-progress {
    margin-top: 16px;
}

.rv-progress-bar {
    height: 6px;
    background-color: #E2E8F0;
    border-radius: 3px;
    overflow: hidden;
}

.rv-progress-fill {
    height: 100%;
    background-color: #6B9ECE;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Murs existants */
.rv-existing-walls {
    margin-top: 24px;
}

.rv-existing-walls h4 {
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
    margin: 0 0 12px;
}

.rv-walls-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
    gap: 12px;
}

.rv-wall-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/10;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.rv-wall-thumb:hover {
    border-color: #6B9ECE;
}

.rv-wall-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rv-wall-thumb-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background-color: rgba(229, 115, 115, 0.9);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.rv-wall-thumb:hover .rv-wall-thumb-delete {
    opacity: 1;
}

/* lucide.createIcons() remplace le <i> par un <svg> : sans le second
   selecteur, la taille ne s'appliquait plus et l'icone debordait du bouton. */
.rv-wall-thumb-delete i,
.rv-wall-thumb-delete svg {
    width: 14px;
    height: 14px;
}

/* ================================================================
   9. ÉCRAN CALIBRATION
   ================================================================ */
#rvScreenCalibrate {
    overflow: hidden;
}

.rv-calibrate-layout {
    display: flex;
    flex: 1;
    height: 100%;
}

.rv-calibrate-instructions {
    width: 320px;
    padding: 24px;
    background-color: #FFFFFF;
    border-right: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.rv-calibrate-instructions h3 {
    font-size: 18px;
    font-weight: 700;
    color: #4A5568;
    margin: 0 0 12px;
}

.rv-calibrate-instructions p {
    font-size: 14px;
    color: #718096;
    line-height: 1.5;
}

.rv-calibrate-distance {
    margin-top: 24px;
}

.rv-calibrate-distance label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
    margin-bottom: 8px;
}

.rv-calibrate-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.rv-calibrate-input-row span {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

.rv-calibrate-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #E8ECEF;
    cursor: crosshair;
}

.rv-calibrate-viewport img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rv-calibrate-point {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: #6B9ECE;
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 5;
    pointer-events: none;
    flex-shrink: 0;
}

.rv-calibrate-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

/* ================================================================
   10. PANNEAU SCÈNES SAUVEGARDÉES
   ================================================================ */
.rv-scenes-panel {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100vh;
    height: 100dvh;
    background-color: #FFFFFF;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 60000;
    transition: right 0.3s ease-out;
    display: flex;
    flex-direction: column;
    border-radius: 16px 0 0 16px;
}

.rv-scenes-panel.rv-scenes-open {
    right: 0;
}

.rv-scenes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E2E8F0;
}

.rv-scenes-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #4A5568;
    margin: 0;
}

.rv-scenes-header button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
}

.rv-scenes-header button:hover {
    background-color: #EEF1F5;
}

.rv-scenes-header button i {
    width: 18px;
    height: 18px;
}

.rv-scenes-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.rv-scenes-empty {
    text-align: center;
    padding: 40px 20px;
    color: #A0AEC0;
}

.rv-scenes-empty i {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    opacity: 0.4;
}

.rv-scenes-empty p {
    font-size: 14px;
    margin: 0;
}

.rv-scene-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s;
    margin-bottom: 8px;
}

.rv-scene-card:hover {
    background-color: #F7FAFC;
}

.rv-scene-card-thumb {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #EEF1F5;
}

.rv-scene-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rv-scene-card-info {
    flex: 1;
    min-width: 0;
}

.rv-scene-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #4A5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-scene-card-date {
    font-size: 11px;
    color: #A0AEC0;
    margin-top: 2px;
}

.rv-scene-card-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A0AEC0;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.2s;
}

.rv-scene-card:hover .rv-scene-card-delete {
    opacity: 1;
}

.rv-scene-card-delete:hover {
    background-color: rgba(229, 115, 115, 0.1);
    color: #E57373;
}

.rv-scene-card-delete i,
.rv-scene-card-delete svg {
    width: 16px;
    height: 16px;
}

/* ================================================================
   11. MODALES
   ================================================================ */
.rv-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 70000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rv-modal {
    background-color: #FFFFFF;
    border-radius: 16px;
    padding: 28px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.rv-modal h3 {
    font-size: 18px;
    font-weight: 700;
    color: #4A5568;
    margin: 0 0 16px;
}

.rv-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ================================================================
   12. ÉLÉMENTS COMMUNS
   ================================================================ */

/* Input */
.rv-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    color: #4A5568;
    transition: border-color 0.2s;
    background-color: #FFFFFF;
    box-sizing: border-box;
}

.rv-input:focus {
    outline: none;
    border-color: #6B9ECE;
    box-shadow: 0 0 0 3px rgba(107, 158, 206, 0.15);
}

/* Boutons */
.rv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rv-btn-primary {
    background-color: #6B9ECE;
    color: #FFFFFF;
}

.rv-btn-primary:hover {
    background-color: #5A8AB5;
}

.rv-btn-secondary {
    background-color: #EEF1F5;
    color: #4A5568;
}

.rv-btn-secondary:hover {
    background-color: #E2E8F0;
}

/* Spinners */
.rv-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #E2E8F0;
    border-top-color: #6B9ECE;
    border-radius: 50%;
    animation: rv-spin 0.8s linear infinite;
    flex-shrink: 0;
}

.rv-spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid #E2E8F0;
    border-top-color: #6B9ECE;
    border-radius: 50%;
    animation: rv-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes rv-spin {
    to { transform: rotate(360deg); }
}

.rv-panel-loading {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.rv-templates-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.rv-templates-loading p {
    margin-top: 12px;
    font-size: 14px;
}

/* ================================================================
   13. TOAST NOTIFICATION
   ================================================================ */
.rv-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: #4A5568;
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 80000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s ease;
}

.rv-toast.rv-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.rv-toast.rv-toast-success {
    background-color: #48BB78;
}

.rv-toast.rv-toast-error {
    background-color: #E57373;
}

.rv-toast i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ================================================================
   14. MOBILE RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {

    /* Header mobile */
    .rv-header {
        padding: 0 12px;
        height: 50px;
    }

    .rv-header-title {
        font-size: 14px;
    }

    .rv-tool-btn span {
        display: none;
    }

    /* Templates : grille 2 colonnes */
    #rvScreenTemplates {
        padding: 16px;
    }

    .rv-templates-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .rv-categories-tabs {
        gap: 6px;
    }

    .rv-cat-tab {
        padding: 6px 14px;
        font-size: 12px;
    }

    /* Main layout : sidebar en bottom-sheet */
    .rv-main-layout {
        flex-direction: column-reverse;
    }

    .rv-sidebar {
        width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-top: 1px solid #E2E8F0;
        border-radius: 16px 16px 0 0;
    }

    .rv-selected-photo {
        display: none;
    }

    .rv-sidebar-footer {
        padding: 10px 12px;
    }

    .rv-add-to-cart-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Viewport mobile */
    .rv-viewport {
        flex: 1;
        min-height: 40vh;
    }

    .rv-toolbar {
        padding: 8px 10px;
        gap: 4px;
    }

    .rv-tool-btn {
        padding: 8px 10px;
    }

    /* Calibration mobile */
    .rv-calibrate-layout {
        flex-direction: column;
    }

    .rv-calibrate-instructions {
        width: 100%;
        padding: 16px;
    }

    .rv-calibrate-viewport {
        min-height: 50vh;
    }

    /* Upload mobile */
    .rv-upload-card {
        padding: 24px 20px;
    }

    .rv-upload-dropzone {
        padding: 30px 16px;
    }

    /* Scenes panel mobile */
    .rv-scenes-panel {
        width: 100%;
        right: -100%;
        border-radius: 0;
    }
}

/* Petits écrans (< 480px) */
@media (max-width: 480px) {
    .rv-templates-gallery {
        grid-template-columns: minmax(0, 1fr);
    }

    .rv-sidebar {
        max-height: 50vh;
    }

    .rv-product-item {
        padding: 8px 10px;
        gap: 10px;
    }

    .rv-product-icon {
        width: 36px;
        height: 36px;
    }

    .rv-product-name {
        font-size: 12px;
    }

    .rv-product-price {
        font-size: 13px;
    }
}

/* ================================================================
   15. ANIMATIONS
   ================================================================ */

/* Transition entre écrans */
.rv-screen {
    animation: rv-fade-in 0.2s ease-out;
}

@keyframes rv-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Photo placée : apparition */
.rv-placed-photo {
    animation: rv-photo-place 0.3s ease-out;
}

@keyframes rv-photo-place {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Template card hover */
.rv-tpl-card {
    animation: rv-fade-in 0.3s ease-out;
    animation-fill-mode: both;
}

.rv-tpl-card:nth-child(1) { animation-delay: 0.02s; }
.rv-tpl-card:nth-child(2) { animation-delay: 0.04s; }
.rv-tpl-card:nth-child(3) { animation-delay: 0.06s; }
.rv-tpl-card:nth-child(4) { animation-delay: 0.08s; }
.rv-tpl-card:nth-child(5) { animation-delay: 0.10s; }
.rv-tpl-card:nth-child(6) { animation-delay: 0.12s; }
.rv-tpl-card:nth-child(7) { animation-delay: 0.14s; }
.rv-tpl-card:nth-child(8) { animation-delay: 0.16s; }

/* Toast slide-up */
@keyframes rv-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Drag feedback */
.rv-dragging {
    opacity: 0.85;
    transition: none !important;
}

/* Print: cacher l'overlay */
@media print {
    .rv-overlay { display: none !important; }
}
