/**
 * 🏠 Customer Walls - Styles pour les murs personnalisés
 * Upload et calibration des murs clients
 */

/* ================================
   MODALE PRINCIPALE
   ================================ */

.pcp-customer-wall-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.pcp-customer-wall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.pcp-customer-wall-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 90vh; /* 🔧 CORRECTION : Limiter à 90% de la hauteur d'écran */
    max-height: 90vh; /* Sécurité supplémentaire */
    margin: 5vh auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pcp-customer-wall-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pcp-customer-wall-close:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

/* ================================
   HEADER
   ================================ */

.pcp-customer-wall-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    text-align: center;
    flex-shrink: 0; /* Ne pas rétrécir */
}

.pcp-customer-wall-header h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
}

.pcp-customer-wall-header p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

/* ================================
   BODY - 🔧 CORRECTION : FLEX LAYOUT
   ================================ */

.pcp-customer-wall-body {
    flex: 1; /* Prendre tout l'espace restant */
    overflow-y: auto; /* Scroll si nécessaire */
    padding: 20px;
    min-height: 0; /* Important pour que flex fonctionne */
}

/* ================================
   ÉTAPES
   ================================ */

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-header h4 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

/* ================================
   UPLOAD ZONE
   ================================ */

.upload-zone {
    border: 3px dashed #0073aa;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-zone:hover {
    border-color: #005a87;
    background: #e8f4f8;
}

.upload-zone.drag-over {
    border-color: #00a32a;
    background: #e8f8ea;
}

.upload-icon {
    color: #0073aa;
    margin-bottom: 20px;
}

.upload-zone p {
    margin: 5px 0;
    color: #333;
}

.upload-zone p strong {
    font-size: 18px;
    color: #0073aa;
}

.upload-info {
    font-size: 13px;
    color: #666;
    margin-top: 15px !important;
}

/* ================================
   FILE PREVIEW
   ================================ */

.file-preview {
    text-align: center;
}

.file-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.preview-info p {
    margin: 5px 0;
    color: #666;
}

/* ================================
   CALIBRATION - 🔧 CORRECTION PRINCIPALE
   ================================ */

.calibration-step {
    display: flex;
    flex-direction: column;
    height: 100%; /* Prendre toute la hauteur disponible */
    position: relative; /* 🔧 Parent pour le positionnement du badge */
}

.calibration-instructions {
    background: #e8f4f8;
    border-left: 3px solid #0073aa;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    flex-shrink: 0; /* Ne pas rétrécir */
    font-size: 13px;
}

.calibration-instructions p {
    margin: 0 0 6px 0;
    color: #333;
    font-weight: 600;
}

.calibration-instructions ol {
    margin: 6px 0 0 18px;
    padding: 0;
}

.calibration-instructions li {
    margin: 3px 0;
    color: #555;
    line-height: 1.4;
}

/* 🔧 CORRECTION : Canvas wrapper flexible */
.calibration-canvas-wrapper {
    position: relative;
    flex: 1; /* Prendre l'espace restant */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
    min-height: 0; /* Important pour flex */
    overflow: hidden; /* Pas de débordement */
}

/* 🔧 CORRECTION : Canvas qui s'adapte */
#calibration-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%; /* S'adapte à la hauteur du wrapper */
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
}

.calibration-info {
    display: block; /* 🔧 Dans le flux normal */
    width: fit-content;
    margin: 15px auto; /* 🔧 Centré avec marges haut/bas */
    padding: 8px 20px;
    background: #0073aa;
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0; /* Ne pas rétrécir */
}

/* ================================
   DISTANCE INPUT
   ================================ */

.distance-input-wrapper {
    background: white;
    padding: 12px 15px;
    border-radius: 6px;
    border: 2px solid #0073aa;
    margin-bottom: 15px;
    flex-shrink: 0; /* Ne pas rétrécir */
}

.distance-input-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.distance-input-wrapper input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.distance-input-wrapper input[type="number"]:focus {
    outline: none;
    border-color: #0073aa;
}

.distance-input-wrapper small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 12px;
}

/* ================================
   ACTIONS
   ================================ */

.calibration-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0; /* Ne pas rétrécir */
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #0073aa;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: white;
    color: #0073aa;
    border: 2px solid #0073aa;
}

.btn-secondary:hover {
    background: #f0f7fa;
}

/* ================================
   SUCCESS STEP
   ================================ */

.success-step {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.success-step h3 {
    color: #00a32a;
    font-size: 28px;
    margin: 0 0 15px 0;
}

.success-step p {
    color: #666;
    font-size: 16px;
    margin: 0 0 30px 0;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .pcp-customer-wall-content {
        width: 95%;
        height: 95vh;
        margin: 2.5vh auto;
    }
    
    .pcp-customer-wall-header {
        padding: 20px;
    }
    
    .pcp-customer-wall-header h3 {
        font-size: 22px;
    }
    
    .pcp-customer-wall-body {
        padding: 20px;
    }
    
    .step-header h4 {
        font-size: 18px;
    }
    
    .calibration-canvas-wrapper {
        padding: 10px;
    }
    
    .calibration-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

/* ================================
   BOUTON "UTILISER MON MUR" dans Room View
   ================================ */

#pcp-use-my-wall-btn {
    width: auto; /* 🔧 Auto au lieu de 100% */
    display: inline-flex; /* 🔧 inline-flex au lieu de flex */
    padding: 15px 30px; /* 🔧 Padding horizontal augmenté pour un peu plus large que le texte */
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#pcp-use-my-wall-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}
