/**
 * STYLES UNIFIÉS - FORMULAIRES ET INTERFACES
 * Base commune pour : messagerie, TJM shortcode, TJM interface
 * 
 * @package BricksChild
 * @subpackage Components
 * @version 2.0.0
 * @date 2025-01-25
 * 
 * NETTOYAGE COMPLET (25/08/2025) :
 * - Tous les styles timeline-item, timeline-content, timeline-title, timeline-description CENTRALISÉS ici
 * - Styles btn-success CENTRALISÉS ici avec priorité maximale
 * - Autres fichiers CSS nettoyés des conflits (timeline.css, buttons.css, tjm-modals-unified.css, vendor-interface.css)
 * - Styles inline PHP désactivés (VendorInterface.php)
 * - Source unique de vérité pour les éléments <div class="timeline-item action-item">
 */

/* ============================================
   ANIMATIONS POUR EFFETS MODERNES
   ============================================ */

/* Animation shimmer pour dégradé */
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ============================================
   VARIABLES CSS PARTAGÉES
   ============================================ */
:root {
    /* Couleurs principales (harmonisées avec messagerie) */
    --form-primary: #8b5cf6;
    --form-primary-hover: #7c3aed;
    --form-background: #ffffff;      /* BLANC comme messagerie */
    --form-border: #e1e8ed;
    --form-text-primary: #333;
    --form-text-secondary: #666;
    --form-focus-color: #8b5cf6;
    
    /* SURCHARGE DES VARIABLES VENDOR POUR FOND BLANC */
    --vendor-header-gray: #ffffff !important;
    --vendor-background: #ffffff !important;
    
    /* Espacements unifiés */
    --form-spacing-xs: 4px;
    --form-spacing-sm: 8px;
    --form-spacing-md: 12px;
    --form-spacing-lg: 20px;
    --form-spacing-xl: 24px;
    
    /* Bordures unifiées */
    --form-border-radius: 8px;
    --form-border-radius-sm: 6px;
    --form-border-width: 1px;
    
    /* Ombres unifiées */
    --form-shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --form-shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --form-transition: all 0.3s ease;
}

/* ============================================
   BASE COMMUNE - CONTAINERS FORMULAIRES
   ============================================ */

.message-form,
.tjm-form-container,
.tjm-block,
.unified-form-container {
    width: 100%;
    max-width: none;
    background: var(--form-background);
    border: var(--form-border-width) solid var(--form-border);
    border-radius: var(--form-border-radius);
    padding: var(--form-spacing-lg);
    margin-bottom: var(--form-spacing-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: var(--form-shadow-light);
    transition: var(--form-transition);
    box-sizing: border-box;
}

/* TJM Unified Box - Sans bordure ni ombre (conteneur interne) */
.tjm-unified-box {
    width: 100%;
    max-width: none;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: var(--form-spacing-lg);
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: none;
    box-sizing: border-box;
    box-shadow: none !important;
}

.tjm-unified-box:hover {
    background: transparent !important;
    box-shadow: none !important;
}

.message-form:hover,
.tjm-form-container:hover,
.tjm-block:hover,
.unified-form-container:hover {
    box-shadow: var(--form-shadow-medium);
}


/* ============================================
   HEADERS UNIFIÉS
   ============================================ */

.tjm-header,
.form-header,
.unified-form-header {
    display: flex;
    align-items: center;
    gap: var(--form-spacing-md);
    margin-bottom: var(--form-spacing-lg);
    padding-bottom: var(--form-spacing-md);
    border-bottom: var(--form-border-width) solid var(--form-border);
}

.tjm-header h3,
.form-header h3,
.unified-form-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--form-text-primary);
}

.tjm-header .emoji,
.form-header .emoji,
.unified-form-header .emoji {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--form-primary);
    color: white;
    border-radius: 50%;
}

.tjm-subtitle,
.form-subtitle,
.unified-form-subtitle {
    margin: var(--form-spacing-sm) 0 0 0;
    color: var(--form-text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

/* ============================================
   CHAMPS DE FORMULAIRE UNIFIÉS
   ============================================ */

.message-form textarea[name="message"],
.message-form input,
.tjm-form-container input,
.tjm-form-container select,
.tjm-form-container textarea,
.tjm-block input,
.tjm-block select,
.tjm-block textarea,
.unified-form-container input,
.unified-form-container select,
.unified-form-container textarea {
    width: 100%;
    padding: var(--form-spacing-md);
    border: var(--form-border-width) solid #ddd;
    border-radius: var(--form-border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--form-transition);
    box-sizing: border-box;
    background: var(--form-background);
    color: var(--form-text-primary);
}

/* Textarea spécifique */
.message-form textarea[name="message"],
.tjm-form-container textarea,
.tjm-block textarea,
.unified-form-container textarea {
    min-height: 80px;
    resize: vertical;
    margin-bottom: var(--form-spacing-md);
}

/* États focus unifiés */
.message-form textarea[name="message"]:focus,
.message-form input:focus,
.tjm-form-container input:focus,
.tjm-form-container select:focus,
.tjm-form-container textarea:focus,
.tjm-block input:focus,
.tjm-block select:focus,
.tjm-block textarea:focus,
.unified-form-container input:focus,
.unified-form-container select:focus,
.unified-form-container textarea:focus {
    border-color: var(--form-focus-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Labels unifiés */
.tjm-form-container label,
.tjm-block label,
.unified-form-container label,
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--form-text-primary);
    margin-bottom: var(--form-spacing-sm);
}

/* ============================================
   SECTIONS SPÉCIALISÉES
   ============================================ */

/* Prix TJM */
.tjm-price-display,
.price-display,
.unified-price-display {
    background: var(--form-background);
    border: var(--form-border-width) solid var(--form-border);
    border-radius: var(--form-border-radius-sm);
    padding: var(--form-spacing-md);
    margin: var(--form-spacing-md) 0;
    text-align: center;
}

.tjm-price-label,
.price-label {
    font-size: 12px;
    color: var(--form-text-secondary);
    margin-bottom: var(--form-spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.tjm-price-amount,
.price-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--form-primary);
    display: block;
}

/* ============================================
   UPLOAD DE FICHIERS UNIFIÉ
   ============================================ */

.message-form .attach-file-button,
#attach-file-btn.attach-file-button,
.tjm-file-upload,
.unified-file-upload {
    background: var(--form-background) !important;
    border: 2px dashed #cbd5db !important;
    color: var(--form-text-primary) !important;
    padding: var(--form-spacing-lg) !important;
    border-radius: var(--form-border-radius) !important;
    cursor: pointer !important;
    transition: var(--form-transition) !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: var(--form-spacing-sm) !important;
    min-height: 120px !important;
    text-align: center !important;
    position: relative !important;
    box-sizing: border-box !important;
}

.message-form .attach-file-button .emoji,
#attach-file-btn.attach-file-button .emoji,
.tjm-file-upload .emoji,
.unified-file-upload .emoji {
    font-size: 24px !important;
    margin-bottom: var(--form-spacing-sm) !important;
    width: 24px !important;
    height: 24px !important;
    display: block !important;
}

.message-form .attach-file-button::before,
#attach-file-btn.attach-file-button::before,
.tjm-file-upload::before,
.unified-file-upload::before {
    content: 'Cliquer pour joindre des fichiers' !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--form-text-primary) !important;
    margin-bottom: 4px !important;
    display: block !important;
}

.message-form .attach-file-button::after,
#attach-file-btn.attach-file-button::after,
.tjm-file-upload::after,
.unified-file-upload::after {
    content: 'Formats acceptés: JPG, PNG, PDF, DOC, ZIP (max 10MB)' !important;
    font-size: 12px !important;
    color: var(--form-text-secondary) !important;
    display: block !important;
}

.message-form .attach-file-button:hover,
#attach-file-btn.attach-file-button:hover,
.tjm-file-upload:hover,
.unified-file-upload:hover {
    border-color: var(--form-focus-color) !important;
    transform: translateY(-2px) !important;
}

/* ============================================
   BOUTONS UNIFIÉS - SPÉCIFIQUES SEULEMENT
   ============================================ */

.message-form-actions button[type="submit"],
.tjm-add-button,
.tjm-submit-button,
.unified-submit-button {
    background: linear-gradient(135deg, var(--form-primary) 0%, var(--form-primary-hover) 100%) !important;
    color: white !important;
    border: none !important;
    padding: 15px var(--form-spacing-lg) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: var(--form-border-radius-sm) !important;
    cursor: pointer !important;
    transition: var(--form-transition) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: var(--form-spacing-sm) !important;
    width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
    width: 100% !important;
    min-height: 55px !important;
    box-sizing: border-box !important;
}

.message-form-actions button[type="submit"]:hover,
.tjm-add-button:hover,
.tjm-submit-button:hover,
.unified-submit-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: var(--form-shadow-medium) !important;
}

.message-form-actions button[type="submit"] .emoji,
.tjm-add-button .emoji,
.tjm-submit-button .emoji,
.unified-submit-button .emoji {
    width: 18px !important;
    height: 18px !important;
}

/* ============================================
   ACTIONS ET GROUPES DE BOUTONS
   ============================================ */

.message-form-actions,
.tjm-actions,
.unified-form-actions {
    margin-top: var(--form-spacing-md);
    display: flex;
    gap: var(--form-spacing-sm);
    flex-direction: column;
}

@media (min-width: 768px) {
    .message-form-actions,
    .tjm-actions,
    .unified-form-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ============================================
   LAYOUTS SPÉCIALISÉS TJM
   ============================================ */

.tjm-row,
.tjm-content-row {
    display: flex;
    gap: var(--form-spacing-lg);
    margin-bottom: var(--form-spacing-lg);
    flex-wrap: wrap;
}

.tjm-days-selector,
.tjm-price-display {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .tjm-row,
    .tjm-content-row {
        flex-direction: column;
        gap: var(--form-spacing-md);
    }
}

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

/* Spécifique au conteneur TJM pour assurer la cohérence de largeur */
.customer-interface-force .container,
.vendor-interface-force .container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* STATUS PROGRESS BOX - TIMELINE AVEC FOND BLANC (CENTRALISÉ VENDOR & CUSTOMER) */
.status-progress-box {
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: var(--koldkaze-spacing-lg) !important;
    margin: var(--koldkaze-spacing-lg) 0 !important;
    font-family: var(--koldkaze-font-family) !important;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.status-progress-box::before {
    display: none !important;
}



/* TIMELINE PROGRESS - MUTUALISÉ VENDOR & CUSTOMER */
.status-progress-timeline {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    padding: var(--koldkaze-spacing-md) 0 !important;
}

.progress-step {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    position: relative !important;
    z-index: 2 !important;
    flex: 1 !important;
    max-width: 100px !important;
}

/* Icône de validation pour les étapes terminées */
.progress-step::after {
    content: '✓';
    position: absolute;
    top: -2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--koldkaze-primary);
    color: var(--koldkaze-white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 3;
    box-shadow: var(--koldkaze-shadow-sm);
}

.progress-step.completed::after {
    display: flex;
}

/* Icône de l'étape */
.step-icon {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    margin-bottom: var(--koldkaze-spacing-xs) !important;
    background: var(--koldkaze-light-gray) !important;
    color: var(--koldkaze-gray) !important;
    border: 2px solid var(--koldkaze-border-color) !important;
    transition: all 0.3s ease !important;
}

/* Label de l'étape */
.step-label {
    font-size: var(--koldkaze-font-size-xs) !important;
    font-weight: 500 !important;
    color: var(--koldkaze-gray) !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
}

/* ========================================
   ÉTATS DES ÉTAPES - MUTUALISÉ VENDOR & CUSTOMER
   ======================================== */

/* Étape terminée */
.progress-step.completed .step-icon {
    background: var(--koldkaze-light-gray) !important;
    color: var(--koldkaze-gray) !important;
    border: none !important;
    box-shadow: 0 0 0 2px var(--koldkaze-primary) !important;
}

.progress-step.completed .step-label {
    color: var(--koldkaze-primary) !important;
    font-weight: 600 !important;
}

/* Étape en cours */
.progress-step.current .step-icon {
    background: var(--koldkaze-primary) !important;
    color: var(--koldkaze-white) !important;
    border-color: var(--koldkaze-primary) !important;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.15) !important;
    transform: scale(1.1) !important;
    animation: pulse-current 2s infinite !important;
}

.progress-step.current .step-label {
    color: var(--koldkaze-primary) !important;
}

/* Étape en attente */
.progress-step.pending .step-icon {
    background: var(--koldkaze-light-gray) !important;
    color: var(--koldkaze-gray) !important;
    border-color: var(--koldkaze-border-color) !important;
}

.progress-step.pending .step-label {
    color: var(--koldkaze-gray) !important;
}

/* Animation pour l'étape en cours */
@keyframes pulse-current {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.12);
    }
}

/* ========================================
   SECTIONS TIMELINE - MUTUALISÉ VENDOR & CUSTOMER
   ======================================== */

/* Les sections doivent avoir la même largeur */
.customer-timeline-section,
.vendor-timeline-section,
.delivery-communication {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1px solid var(--koldkaze-border-color) !important;
    border-radius: var(--koldkaze-border-radius) !important;
    margin: var(--koldkaze-spacing-lg) 0 !important;
    padding: var(--koldkaze-spacing-lg) !important;
}

/* SÉLECTEURS ULTRA-SPÉCIFIQUES POUR FORCER LE FOND BLANC */
div.vendor-timeline-section,
div.customer-timeline-section,
.vendor-interface .vendor-timeline-section,
.customer-interface .customer-timeline-section,
.wcfm-vendor-interface .vendor-timeline-section,
.wcfm-customer-interface .customer-timeline-section {
    background-color: #ffffff !important;
    background: #ffffff !important;
}
div.vendor-timeline-section,
.vendor-interface .vendor-timeline-section,
.wcfm-vendor-interface .vendor-timeline-section {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

/* ============================================
   STYLES VENDOR TIMELINE SECTION - CENTRALISÉS
   ============================================ */

/* Titre de la section timeline */
.vendor-timeline-section h3 {
    margin: 0 0 var(--form-spacing-lg) 0 !important;
    color: #495057 !important;
    font-size: var(--form-spacing-lg) !important;
    font-weight: 600 !important;
}

/* Timeline horizontale */
.vendor-timeline-section .timeline-horizontal {
    min-height: 200px !important;
    padding: var(--form-spacing-xl) 0 !important;
    display: flex !important;
    overflow-x: auto !important;
    gap: var(--form-spacing-lg) !important;
}

.vendor-timeline-section .timeline-horizontal .timeline-item {
    flex: 0 0 200px !important;
    min-width: 200px !important;
    max-width: 250px !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important;
    padding-top: calc(60px + var(--form-spacing-md)) !important;
}

/* Badges dans la timeline */
.vendor-timeline-section .timeline-badge {
    font-size: 11px !important;
    padding: var(--form-spacing-xs) var(--form-spacing-sm) !important;
    border-radius: 12px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* ============================================
   TIMELINE ACTIONS - STYLES UNIFIÉS ET CENTRALISÉS (SECTION UNIQUE)
   ============================================ */

/* ============================================
   STYLES TIMELINE BUTTONS - SIMPLIFIÉ
   ============================================ */

.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn.btn-success,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button.btn-success {
    background: var(--koldkaze-primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--koldkaze-primary) !important;
    padding: 20px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    min-height: 50px !important;
    min-width: 200px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: var(--form-spacing-sm) !important;
}

.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn:hover,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button:hover,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn.btn-success:hover,
.timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button.btn-success:hover {
    background: var(--koldkaze-primary-hover) !important;
    border-color: var(--koldkaze-primary-hover) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Responsive pour vendor timeline section */
@media (max-width: 767px) {
    .timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn,
    .timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button,
    .timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content .btn.btn-success,
    .timeline-actions.vendor-step-actions .timeline-item.action-item .timeline-content button.btn-success {
        width: 100% !important;
        min-width: auto !important;
    }
}

/* ============================================
   RESPONSIVE GÉNÉRAL
   ============================================ */

@media (max-width: 768px) {

/* ============================================
   EMOJI DANS BOUTONS - SPÉCIFICITÉ MAXIMALE
   ============================================ */
.timeline-actions.vendor-step-actions .btn .emoji,
.timeline-actions.vendor-step-actions button .emoji {
    width: 20px !important;
    height: 20px !important;
    margin-right: 4px !important;
}

/* ============================================
   ANTI-FLASH - SUPPRESSION TOTALE DES ANIMATIONS
   ============================================ */

/* Suppression de toutes les transitions - SPÉCIFICITÉ MAXIMALE */
.timeline-actions.vendor-step-actions,
.timeline-actions.vendor-step-actions *,
.timeline-actions.vendor-step-actions *::before,
.timeline-actions.vendor-step-actions *::after {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    backface-visibility: hidden !important;
    will-change: auto !important;
    perspective: 1000px !important;
}

/* ANTI-FLASH SPÉCIFIQUE POUR LE HTML FOURNI */
div.timeline-actions.vendor-step-actions div.timeline-item.action-item div.timeline-content button.btn.btn-success {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    backface-visibility: hidden !important;
    will-change: auto !important;
}

/* COULEUR DE FOND POUR LES ACTIONS VENDEUR */
.timeline-actions.vendor-step-actions,
div.timeline-actions.vendor-step-actions {
    background: #f8f9fa !important;
    background-color: #f8f9fa !important;
}

@media (max-width: 768px) {
    .message-form,
    .tjm-form-container,
    .tjm-block,
    .unified-form-container {
        padding: var(--form-spacing-md);
        margin-bottom: var(--form-spacing-md);
    }
    
    .tjm-header h3,
    .form-header h3,
    .unified-form-header h3 {
        font-size: 16px;
    }
    
    .message-form-actions button[type="submit"],
    .tjm-add-button,
    .tjm-submit-button,
    .unified-submit-button {
        padding: 10px 15px !important;
        font-size: 14px !important;
        min-height: 45px !important;
    }
}
