﻿/* Styles pour l'éditeur Quill */
.rich-text-editor {
    margin-bottom: 1rem;
}

/* Barre d'outils Quill */
#toolbar {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Boutons de la barre d'outils */
#toolbar button {
    background-color: white;
    border: 1px solid #dee2e6;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

#toolbar button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

#toolbar button.ql-active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

#toolbar select {
 padding: 0.375rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    background-color: white;
    cursor: pointer;
}

/* Espaceur dans la barre d'outils */
.ql-formats {
    display: inline-block;
    width: 1px;
    height: 26px;
    background-color: #dee2e6;
margin: 0 0.25rem;
    vertical-align: middle;
}

/* Éditeur Quill */
.ql-editor {
    min-height: 400px;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

.ql-editor.ql-blank::before {
    color: #adb5bd;
    font-style: italic;
}

/* Conteneur global */
.ql-container {
    border: 1px solid #dee2e6;
    border-radius: 0 0 0.375rem 0.375rem;
}

/* Formats de texte */
.ql-editor strong {
    font-weight: 700;
}

.ql-editor em {
    font-style: italic;
}

.ql-editor u {
    text-decoration: underline;
}

.ql-editor s {
  text-decoration: line-through;
}

/* Titres */
.ql-editor h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.ql-editor h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.ql-editor h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.ql-editor h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

/* Listes */
.ql-editor ol,
.ql-editor ul {
 padding-left: 2rem;
    margin: 0.5rem 0;
}

.ql-editor li {
 margin-bottom: 0.25rem;
}

/* Blocs de code */
.ql-editor code-block {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* Liens */
.ql-editor a {
    color: #0d6efd;
 text-decoration: none;
}

.ql-editor a:hover {
    text-decoration: underline;
}

/* Alignement */
.ql-editor.ql-align-center {
    text-align: center;
}

.ql-editor.ql-align-right {
    text-align: right;
}

.ql-editor.ql-align-justify {
    text-align: justify;
}

/* Couleurs */
.ql-editor .ql-color-1 {
    color: #1a1a1a;
}

.ql-editor .ql-bg-1 {
    background-color: #ffff00;
}

/* Mode focus */
.ql-editor:focus {
  outline: none;
}

.ql-container.ql-focused .ql-editor {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    #toolbar {
        padding: 0.25rem;
    }

    #toolbar button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .ql-editor {
        min-height: 250px;
        padding: 0.75rem;
    }
}

/* ✅ NOUVEAU - Styles pour le mode édition HTML */

/* Bouton mode HTML */
.btn-outline-secondary {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-outline-secondary.active {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Modal d'édition HTML */
.modal.d-block {
    display: block !important;
    z-index: 1050;
}

.modal-dialog {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body textarea {
    border: 1px solid #dee2e6;
    padding: 1rem;
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #212529;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

.modal-body textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background-color: white;
}

/* Overlay sombre pour le modal */
.modal.d-block::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.modal.d-block .modal-dialog {
    position: relative;
    z-index: 1050;
}

/* Animations */
.modal.d-block .modal-content {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive pour le modal */
@media (max-width: 768px) {
    .modal-lg {
        max-width: 95%;
    }

    .modal-body textarea {
        font-size: 12px;
        height: 300px !important;
    }
}

/* ✅ NOUVEAU - Assure que les images s'adaptent et peuvent être redimensionnées visuellement */
.ql-editor img {
    max-width: 100%;
    height: auto;
}

/* Optionnel: améliorer la visibilité des poignées (dépend du module) */
.ql-image-resize-handle {
    border: 1px solid #0d6efd;
}
