/* ========================================
   Styles pour les formulaires de facture
   Force la priorité sur cta-final.css
   ======================================== */

/* Container principal - neutralise TOUS les styles */
.invoice-form-wrapper {
    /* Reset complet des styles hérités */
    all: unset !important;
    display: block !important;

    /* Style de base harmonisé avec le dashboard */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: #2c3e50 !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    background: transparent !important;
}

/* Reset COMPLET de tous les enfants */
.invoice-form-wrapper *,
.invoice-form-wrapper *::before,
.invoice-form-wrapper *::after {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* Exception pour les icônes Bootstrap Icons */
.invoice-form-wrapper .bi,
.invoice-form-wrapper i.bi {
    font-family: "bootstrap-icons" !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Titres de sections */
.invoice-form-wrapper h5 {
    color: #2c3e50 !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    margin-bottom: 1rem !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.invoice-form-wrapper h5 i {
    color: #6c757d !important;
    margin-right: 0.5rem !important;
}

/* Labels de formulaire ÉLÉGANTS */
.invoice-form-wrapper .form-label,
.invoice-form-wrapper label {
    font-weight: 500 !important;
    color: #495057 !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.875rem !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: 0.01rem !important;
}

/* Style spécial pour les labels requis */
.invoice-form-wrapper .required label::after {
    content: " *" !important;
    color: #dc3545 !important;
}

/* Inputs et selects - STYLE SOBRE ET ÉLÉGANT */
.invoice-form-wrapper .form-control,
.invoice-form-wrapper .form-select,
.invoice-form-wrapper input[type="text"],
.invoice-form-wrapper input[type="email"],
.invoice-form-wrapper input[type="number"],
.invoice-form-wrapper input[type="date"],
.invoice-form-wrapper input[type="tel"],
.invoice-form-wrapper select,
.invoice-form-wrapper textarea {
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.75rem !important; /* Réduit pour un meilleur ratio */
    font-size: 0.938rem !important;
    line-height: 1.5 !important; /* Retour à 1.5 pour une meilleure proportion */
    color: #495057 !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    box-shadow: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-weight: 400 !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
    min-height: 38px !important; /* Réduit de 42px à 38px pour un meilleur équilibre */
}

.invoice-form-wrapper .form-control:focus,
.invoice-form-wrapper .form-select:focus,
.invoice-form-wrapper input:focus,
.invoice-form-wrapper select:focus,
.invoice-form-wrapper textarea:focus {
    border-color: #86b7fe !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
    background-color: #fff !important;
}

/* Textarea */
.invoice-form-wrapper textarea.form-control {
    min-height: 70px !important;
    resize: vertical !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Champ adresse client - Style affiné (moins haut, plus élégant) */
.invoice-form-wrapper textarea#invoice_clientAdresse,
.invoice-form-wrapper textarea[name*="clientAdresse"] {
    min-height: 60px !important; /* Réduit pour être plus compact */
    max-height: 90px !important; /* Limite la hauteur maximale */
    padding: 0.5rem 0.75rem !important;
    line-height: 1.5 !important; /* Ligne plus compacte pour l'adresse */
    font-size: 0.9rem !important; /* Légèrement plus petit pour un look plus affiné */
}

/* Effet subtil au survol des champs */
.invoice-form-wrapper .form-control:hover:not(:focus):not([readonly]),
.invoice-form-wrapper .form-select:hover:not(:focus):not([readonly]) {
    border-color: #b8c5d6 !important;
    transition: border-color 0.15s ease-in-out !important;
}

/* Placeholder élégant */
.invoice-form-wrapper input::placeholder,
.invoice-form-wrapper textarea::placeholder {
    color: #adb5bd !important;
    opacity: 1 !important;
    font-style: italic !important;
    font-size: 0.875rem !important;
}

/* Groupes de formulaire avec espacement harmonieux */
.invoice-form-wrapper .mb-3 {
    margin-bottom: 1.25rem !important;
}

/* Supprimer les flèches des inputs number */
.invoice-form-wrapper input[type="number"]::-webkit-inner-spin-button,
.invoice-form-wrapper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.invoice-form-wrapper input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Style pour les inputs en lecture seule */
.invoice-form-wrapper .form-control[readonly],
.invoice-form-wrapper input[readonly] {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed !important;
    opacity: 0.8 !important;
}

/* Style pour les champs désactivés */
.invoice-form-wrapper .form-control:disabled,
.invoice-form-wrapper .form-select:disabled,
.invoice-form-wrapper input:disabled {
    background-color: #e9ecef !important;
    opacity: 0.65 !important;
    cursor: not-allowed !important;
}

/* Select - style propre avec UNE SEULE flèche */
.invoice-form-wrapper .form-select,
.invoice-form-wrapper select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.5rem !important;
}

/* Cards des items de facture */
.invoice-form-wrapper .invoice-item-row.card,
.invoice-form-wrapper .card {
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    transition: box-shadow 0.2s ease !important;
    background: #fff !important;
}

.invoice-form-wrapper .invoice-item-row.card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1) !important;
}

.invoice-form-wrapper .card-body {
    padding: 1.25rem !important;
}

/* Boutons - STYLE SOBRE comme le dashboard */
.invoice-form-wrapper .btn {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.15s ease-in-out !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border-width: 1px !important;
}

/* Bouton suppression - outline sobre */
.invoice-form-wrapper .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: transparent !important;
}

.invoice-form-wrapper .btn-outline-danger:hover {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

/* Bouton ajouter - outline sobre */
.invoice-form-wrapper .btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
    background-color: transparent !important;
}

.invoice-form-wrapper .btn-outline-primary:hover {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
}

/* Bouton principal - sobre */
.invoice-form-wrapper .btn-primary,
.invoice-form-wrapper button[type="submit"].btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    box-shadow: none !important;
}

.invoice-form-wrapper .btn-primary:hover,
.invoice-form-wrapper button[type="submit"].btn-primary:hover {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #fff !important;
}

/* Bouton secondaire - sobre */
.invoice-form-wrapper .btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
    background-color: transparent !important;
}

.invoice-form-wrapper .btn-outline-secondary:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}

/* Card total */
.invoice-form-wrapper .card.border-primary {
    border-color: #0d6efd !important;
    box-shadow: 0 0.125rem 0.5rem rgba(13, 110, 253, 0.15) !important;
}

.invoice-form-wrapper .card-title.text-primary {
    color: #0d6efd !important;
    font-weight: 600 !important;
}

/* Icônes Bootstrap Icons */
.invoice-form-wrapper .bi {
    vertical-align: middle !important;
}

/* Messages d'erreur */
.invoice-form-wrapper .invalid-feedback {
    color: #dc3545 !important;
    font-size: 0.875rem !important;
    margin-top: 0.25rem !important;
}

.invoice-form-wrapper .is-invalid {
    border-color: #dc3545 !important;
}

/* Espacement et marges */
.invoice-form-wrapper .mb-2 {
    margin-bottom: 0.5rem !important;
}

.invoice-form-wrapper .mb-3 {
    margin-bottom: 1rem !important;
}

.invoice-form-wrapper .mb-4 {
    margin-bottom: 1.5rem !important;
}

.invoice-form-wrapper .mt-4 {
    margin-top: 1.5rem !important;
}

.invoice-form-wrapper .pt-3 {
    padding-top: 1rem !important;
}

/* Bordures */
.invoice-form-wrapper .border-bottom {
    border-bottom: 1px solid #dee2e6 !important;
}

.invoice-form-wrapper .border-top {
    border-top: 1px solid #dee2e6 !important;
}

.invoice-form-wrapper .pb-2 {
    padding-bottom: 0.5rem !important;
}

/* Position relative pour les boutons absolus */
.invoice-form-wrapper .position-relative {
    position: relative !important;
}

.invoice-form-wrapper .position-absolute {
    position: absolute !important;
}

/* Input en lecture seule */
.invoice-form-wrapper .form-control[readonly] {
    background-color: #e9ecef !important;
    opacity: 1 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .invoice-form-wrapper h5 {
        font-size: 1rem !important;
    }

    .invoice-form-wrapper .btn {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.875rem !important;
    }
}

/* ========================================
   AMÉLIORATIONS VISUELLES PROFESSIONNELLES
   ======================================== */

/* Cards avec ombres subtiles SOBRE */
.invoice-form-wrapper .card {
    transition: none !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    border: 1px solid #e0e0e0 !important;
}

.invoice-form-wrapper .card:hover {
    transform: none !important;
}

/* Card body avec padding uniforme */
.invoice-form-wrapper .card-body {
    padding: 1.25rem !important;
}

/* En-têtes de cards SOBRE - style dashboard */
.invoice-form-wrapper .card-header {
    background: #fff !important;
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 0.875rem 1rem !important;
}

.invoice-form-wrapper .card-header h5 {
    margin: 0 !important;
    font-size: 0.938rem !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    letter-spacing: 0.01rem !important;
}

/* Badge sobre */
.invoice-form-wrapper .badge {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.65rem !important;
    font-weight: 500 !important;
}

/* Items de prestation SOBRE */
.invoice-form-wrapper .invoice-item-row {
    position: relative !important;
    transition: box-shadow 0.15s ease !important;
    overflow: visible !important;
    border: 1px solid #dee2e6 !important;
}

.invoice-form-wrapper .invoice-item-row .card-body {
    position: relative !important;
    overflow: visible !important;
}

.invoice-form-wrapper .invoice-item-row:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1) !important;
    transform: none !important;
}

/* Bouton de suppression sobre */
.invoice-form-wrapper .invoice-item-row .btn-outline-danger {
    z-index: 1000 !important;
    position: absolute !important;
}

/* Badge numéro sobre */
.invoice-form-wrapper .invoice-item-row .bg-secondary {
    background-color: #6c757d !important;
}

/* Bouton d'ajout sobre */
.invoice-form-wrapper .btn-outline-primary {
    box-shadow: none !important;
    font-weight: 400 !important;
}

.invoice-form-wrapper .btn-outline-primary:hover {
    box-shadow: none !important;
    transform: none !important;
}

/* Card récapitulatif SOBRE */
.invoice-form-wrapper .card.border.shadow-sm {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.invoice-form-wrapper .card-header.bg-white {
    background: #fff !important;
    border-bottom: 1px solid #dee2e6 !important;
}

/* Champ total sobre */
.invoice-form-wrapper .card .form-control[readonly] {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    text-align: right !important;
    border: 1px solid #dee2e6 !important;
    background-color: #f8f9fa !important;
}

/* Barre d'actions sticky SOBRE */
.invoice-form-wrapper .sticky-bottom {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 1020 !important;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Bouton d'enregistrement sobre */
.invoice-form-wrapper button[type="submit"].btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    box-shadow: none !important;
    font-weight: 400 !important;
}

.invoice-form-wrapper button[type="submit"].btn-primary:hover {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Alerts sobre */
.invoice-form-wrapper .alert {
    border-radius: 0.375rem !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: none !important;
}

.invoice-form-wrapper .alert-light {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #6c757d !important;
}

/* Input focus sobre - sans animation */
.invoice-form-wrapper .form-control:focus,
.invoice-form-wrapper .form-select:focus {
    transform: none !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

/* Séparateur sobre */
.invoice-form-wrapper hr {
    border-top: 1px solid #dee2e6 !important;
    opacity: 1 !important;
}

/* ========================================
   Boutons de filtres rapides - Style sobre et élégant
   ======================================== */

/* Bouton "Tout" */
.btn-sm[href*="app_invoice_index"]:not([href*="statut"]):hover {
    background-color: #f8f9fa !important;
    border-color: #adb5bd !important;
    color: #212529 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

/* Bouton "En attente" */
.btn-sm[href*="facture_en_attente"]:hover {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
    color: #664d03 !important;
    box-shadow: 0 1px 3px rgba(255, 193, 7, 0.15) !important;
}

/* Bouton "Payées" */
.btn-sm[href*="facture_payee"]:hover {
    background-color: #d4edda !important;
    border-color: #28a745 !important;
    color: #0f5132 !important;
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.15) !important;
}

/* Bouton "Devis" */
.btn-sm[href*="statut=devis"]:hover {
    background-color: #d1ecf1 !important;
    border-color: #17a2b8 !important;
    color: #055160 !important;
    box-shadow: 0 1px 3px rgba(23, 162, 184, 0.15) !important;
}
