/**
 * Styles compositions front client — Room View
 * Chemin: public/modules/room-view/room-view-compositions.css
 * Inclus dans le blade public room-view.blade.php
 */

/* ================================================================
   ÉTAPE 1 — CHOIX DU GABARIT
   ================================================================ */
.rv-comp-chooser-header {
    text-align: center;
    padding: 20px;
}
.rv-comp-chooser-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #4A5568;
}
.rv-comp-chooser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
    gap: 16px;
    padding: 0 20px 20px;
    max-width: 900px;
    margin: 0 auto;
}
.rv-comp-card {
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}
.rv-comp-card:hover {
    border-color: var(--accent-color, #6B9ECE);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.rv-comp-card-preview {
    margin-bottom: 10px;
}
.rv-comp-card-preview svg {
    width: 100%;
    max-height: 140px;
    border-radius: 6px;
}
.rv-comp-card-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
}
.rv-comp-card-meta {
    display: block;
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 2px;
}

/* ================================================================
   ÉTAPE 2 — REMPLISSAGE
   ================================================================ */
.rv-comp-fill-layout {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}
.rv-comp-photos-panel {
    width: 220px;
    min-width: 220px;
    background: #fff;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.rv-comp-photos-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.rv-comp-photos-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
}
.rv-comp-photos-grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.rv-comp-photo-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.rv-comp-photo-thumb:hover {
    border-color: var(--accent-color, #6B9ECE);
}
.rv-comp-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Zone centrale remplissage */
.rv-comp-fill-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    overflow: auto;
    background: #F5F5F5;
}
.rv-comp-progress {
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
    margin-bottom: 12px;
    padding: 6px 16px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.rv-comp-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
}
.rv-comp-canvas {
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

/* Slots */
.rv-comp-slot {
    position: absolute;
    border-radius: 3px;
    overflow: hidden;
    box-sizing: border-box;
}
.rv-comp-slot-empty {
    border: 2px dashed #9CA3AF;
    background: rgba(229, 231, 235, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.rv-comp-slot-empty:hover {
    border-color: var(--accent-color, #6B9ECE);
    background: rgba(107, 158, 206, 0.08);
}
.rv-comp-slot-plus {
    width: 24px;
    height: 24px;
    color: #9CA3AF;
}
.rv-comp-slot-empty:hover .rv-comp-slot-plus {
    color: var(--accent-color, #6B9ECE);
}
.rv-comp-slot-dragover {
    border-color: var(--accent-color, #6B9ECE) !important;
    background: rgba(107, 158, 206, 0.15) !important;
    border-style: solid !important;
}
.rv-comp-slot-filled {
    cursor: grab;
}
.rv-comp-slot-filled:active {
    cursor: grabbing;
}
.rv-comp-slot-filled img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
.rv-comp-slot-change {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    flex-shrink: 0;
}
.rv-comp-slot-filled:hover .rv-comp-slot-change {
    opacity: 1;
}
.rv-comp-slot-change i {
    width: 14px;
    height: 14px;
}

/* Signature */
.rv-comp-signature {
    position: absolute;
    pointer-events: none;
    z-index: 3;
}
.rv-comp-signature.bottom_right { bottom: 3%; right: 3%; }
.rv-comp-signature.bottom_left { bottom: 3%; left: 3%; }
.rv-comp-signature.bottom_center { bottom: 3%; left: 50%; transform: translateX(-50%); }

/* Couleur de fond */
.rv-comp-bg-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 8px 16px;
    background: #fff;
    border-radius: 8px;
}
.rv-comp-bg-label {
    font-size: 13px;
    color: #718096;
    white-space: nowrap;
}
.rv-comp-bg-pill {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.rv-comp-bg-pill:hover {
    transform: scale(1.1);
}
.rv-comp-bg-pill-active {
    border-color: var(--accent-color, #6B9ECE);
    box-shadow: 0 0 0 3px rgba(107, 158, 206, 0.25);
}
.rv-comp-bg-picker {
    width: 36px;
    height: 30px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}
.rv-comp-continue-btn {
    margin-top: 16px;
    min-width: 200px;
}

/* ================================================================
   MODALE SÉLECTION PHOTO (pour clic sur slot)
   ================================================================ */
.rv-comp-photo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rv-comp-photo-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}
.rv-comp-photo-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    z-index: 2;
    padding: 4px;
}
.rv-comp-photo-modal-grid {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(80px, 100%), 1fr));
    gap: 8px;
}
.rv-comp-photo-modal-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}
.rv-comp-photo-modal-thumb:hover {
    border-color: var(--accent-color, #6B9ECE);
    transform: scale(1.05);
}
.rv-comp-photo-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================================================================
   ÉTAPE 3 — CHOIX PRODUIT
   ================================================================ */
.rv-comp-product-layout {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}
.rv-comp-products-panel {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #E2E8F0;
    padding: 20px;
    overflow-y: auto;
}
.rv-comp-products-panel h4 {
    font-size: 15px;
    font-weight: 600;
    color: #4A5568;
    margin: 0 0 16px 0;
}
.rv-comp-product-card {
    padding: 14px;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.rv-comp-product-card:hover {
    border-color: var(--accent-color, #6B9ECE);
}
.rv-comp-product-card-active {
    border-color: var(--accent-color, #6B9ECE);
    background: rgba(107, 158, 206, 0.05);
    box-shadow: 0 0 0 3px rgba(107, 158, 206, 0.15);
}
.rv-comp-product-name {
    font-size: 15px;
    font-weight: 600;
    color: #4A5568;
}
.rv-comp-product-dim {
    font-size: 13px;
    color: #9CA3AF;
    margin-top: 2px;
}
.rv-comp-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color, #6B9ECE);
    margin-top: 6px;
}
.rv-comp-product-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(107, 158, 206, 0.1);
    color: var(--accent-color, #6B9ECE);
    border-radius: 4px;
    margin-top: 4px;
}
.rv-comp-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #F5F5F5;
}
.rv-comp-add-cart-btn {
    min-width: 240px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .rv-comp-fill-layout,
    .rv-comp-product-layout {
        flex-direction: column;
    }
    .rv-comp-photos-panel,
    .rv-comp-products-panel {
        width: 100%;
        min-width: 0;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #E2E8F0;
    }
    .rv-comp-photos-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .rv-comp-chooser-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
