/* Rich Text Editor Styles per Sus4Kids */

.rich-text-container {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.rich-text-container:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.rich-text-container.is-invalid {
    border-color: #dc3545;
}

.rich-text-container.is-invalid:focus-within {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Toolbar personalizzata */
.ql-toolbar {
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 8px 12px;
}

.ql-container {
    border: none;
    font-family: inherit;
    font-size: 1rem;
    border-radius: 0 0 0.375rem 0.375rem;
}

.ql-editor {
    min-height: 80px;
    padding: 12px;
    line-height: 1.5;
}

.ql-editor.ql-blank::before {
    color: #6c757d;
    font-style: italic;
}

/* Stili per i pulsanti della toolbar */
.ql-toolbar .ql-formats {
    margin-right: 15px;
}

.ql-toolbar button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    margin: 0 1px;
}

.ql-toolbar button:hover {
    background-color: #e9ecef;
}

.ql-toolbar button.ql-active {
    background-color: #0d6efd;
    color: white;
}

.ql-toolbar .ql-stroke {
    stroke: #495057;
}

.ql-toolbar button.ql-active .ql-stroke {
    stroke: white;
}

.ql-toolbar .ql-fill {
    fill: #495057;
}

.ql-toolbar button.ql-active .ql-fill {
    fill: white;
}

/* Dimensioni specifiche per diversi campi */
.rich-text-short {
    min-height: 100px;
}

.rich-text-medium {
    min-height: 150px;
}

.rich-text-large {
    min-height: 200px;
}

.rich-text-short .ql-editor {
    min-height: 60px;
}

.rich-text-medium .ql-editor {
    min-height: 100px;
}

.rich-text-large .ql-editor {
    min-height: 150px;
}

/* Contatore caratteri */
.character-counter {
    font-size: 0.875rem;
    color: #6c757d;
    text-align: right;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 0.375rem 0.375rem;
}

.character-counter.warning {
    color: #fd7e14;
}

.character-counter.danger {
    color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .ql-toolbar {
        padding: 6px 8px;
    }
    
    .ql-toolbar button {
        width: 24px;
        height: 24px;
    }
    
    .ql-toolbar .ql-formats {
        margin-right: 10px;
    }
    
    .ql-editor {
        padding: 8px;
    }
}

/* Stili per la visualizzazione del contenuto rich text */
.rich-text-content {
    line-height: 1.6;
    color: #333;
}

.rich-text-content p {
    margin-bottom: 1rem;
}

.rich-text-content p:last-child {
    margin-bottom: 0;
}

.rich-text-content strong {
    font-weight: 600;
    color: #2c5530;
}

.rich-text-content em {
    font-style: italic;
}

.rich-text-content u {
    text-decoration: underline;
}

.rich-text-content ol,
.rich-text-content ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.rich-text-content ol li,
.rich-text-content ul li {
    margin-bottom: 0.5rem;
}

.rich-text-content ol {
    list-style-type: decimal;
}

.rich-text-content ul {
    list-style-type: disc;
}

/* Tema scuro per coerenza con Sus4Kids */
.rich-text-container.dark-theme {
    background-color: #2d3748;
    border-color: #4a5568;
}

.dark-theme .ql-toolbar {
    background-color: #1a202c;
    border-color: #4a5568;
}

.dark-theme .ql-container {
    background-color: #2d3748;
}

.dark-theme .ql-editor {
    color: #e2e8f0;
}

.dark-theme .ql-editor.ql-blank::before {
    color: #a0aec0;
}

.dark-theme .character-counter {
    background-color: #1a202c;
    color: #a0aec0;
    border-color: #4a5568;
}

/* Stili per contenuto rich text in tema scuro */
.dark-theme .rich-text-content {
    color: #e2e8f0;
}

.dark-theme .rich-text-content strong {
    color: #68d391;
}
