/* Styles de l'Éditeur Riche (Premium Design - Force Override) */
.editor-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    padding: 15px 20px !important;
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-bottom: 2px solid #f1f3f5 !important;
    border-radius: 12px 12px 0 0 !important;
    align-items: center !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.editor-btn-group {
    display: flex !important;
    gap: 8px !important;
    padding-right: 15px !important;
    border-right: 1px solid #e9ecef !important;
    margin-right: 5px !important;
    align-items: center !important;
}

.editor-btn-group:last-child {
    border-right: none !important;
    margin-left: auto !important;
    /* Push signature to right */
    padding-right: 0 !important;
}

.editor-btn {
    background: #f8f9fa !important;
    border: 1px solid transparent !important;
    color: #495057 !important;
    cursor: pointer !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 15px !important;
    border-radius: 50px !important;
    /* Pill shape */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    gap: 8px !important;
    outline: none !important;
    text-decoration: none !important;
}

.editor-btn:hover {
    background: #e9ecef !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.editor-btn.active {
    background: #3a0ca3 !important;
    /* Primary color */
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(58, 12, 163, 0.4) !important;
}

.editor-btn i {
    font-size: 18px !important;
    line-height: 1 !important;
}

/* Specific styling for the Signature button to make it pop */
.editor-btn[data-command="showSignature"] {
    background: #fff3cd !important;
    color: #856404 !important;
    border: 1px solid #ffeeba !important;
}

.editor-btn[data-command="showSignature"]:hover {
    background: #ffe8a1 !important;
}

/* Zone d'édition (Remplace textarea) */
.editable-document {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
    padding: 2.5cm 2.5cm !important;
    min-height: 25cm !important;
    outline: none !important;
    font-family: 'Times New Roman', Times, serif !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #000000 !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.editable-document:focus {
    box-shadow: 0 0 0 4px rgba(58, 12, 163, 0.15) !important;
}

/* Hide scrollbar within the document but allow scrolling */
.editable-document::-webkit-scrollbar {
    width: 8px;
}

.editable-document::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 4px;
}

/* Signature Modal */
.signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
}

.signature-modal.open {
    display: flex;
    opacity: 1;
}

.signature-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.signature-canvas-container {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 15px 0;
    background: #fff;
    cursor: crosshair;
    position: relative;
}

#signature-canvas {
    width: 100%;
    height: 200px;
    display: block;
}

.signature-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}

.signature-img {
    max-width: 200px;
    display: block;
    margin-top: 10px;
}

/* Print Optimization Override (ensure colors print etc) */
@media print {
    .editor-toolbar {
        display: none !important;
    }

    .editable-document {
        border: none;
        padding: 0;
        box-shadow: none;
        min-height: auto;
    }
}