/* Éditeur personnalisé */
.custom-editor {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    height: 90vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
    z-index: 100000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.editor-open .custom-editor {
    display: flex;
}

.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: none;
}

.editor-open .editor-overlay {
    display: block;
}

/* Barre d'outils de l'éditeur */
.editor-toolbar {
    background: #2c3e50;
    padding: 12px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid #34495e;
    min-height: 60px;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 5px;
    padding-right: 15px;
    border-right: 1px solid #4a607a;
    margin-right: 15px;
}

.toolbar-group:last-child {
    border-right: none;
    margin-right: 0;
}

.editor-btn {
    background: #34495e;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.editor-btn:hover {
    background: #4a607a;
    transform: translateY(-2px);
}

.editor-btn.active {
    background: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.editor-select {
    background: #34495e;
    border: 1px solid #4a607a;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    min-width: 120px;
}

.editor-select option {
    background: #2c3e50;
    color: white;
}

.editor-color {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 5px;
    background: transparent;
}

.editor-input {
    background: #34495e;
    border: 1px solid #4a607a;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    min-width: 200px;
}

/* Zone de contenu de l'éditeur */
.editor-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
    background: #f8f9fa;
    border: none;
    outline: none;
    font-size: 16px;
    line-height: 1.6;
}

.editor-content:focus {
    outline: none;
}

/* Barre d'outils latérale */
.editor-sidebar {
    position: absolute;
    right: 20px;
    top: 80px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
   /* width: 250px; */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: none;
}

.editor-sidebar h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Boutons d'action */
.editor-actions {
    padding: 15px;
    background: #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #ddd;
}

.action-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.action-btn.cancel {
    background: #e74c3c;
    color: white;
}

.action-btn.save {
    background: #2ecc71;
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Image upload */
.image-upload-container {
    background: white;
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.image-upload-container:hover {
    background: #f8f9fa;
    border-color: #2980b9;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    margin: 20px auto;
    display: none;
}

/* File upload */
.file-upload-container {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 5px;
}

.file-item:hover {
    background: #f8f9fa;
}

/* PDF Viewer Styles */
.pdf-container {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pdf-toolbar {
    background: linear-gradient(135deg, #2c3e50, #4a607a);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-toolbar-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-toolbar-btn:hover {
    background: rgba(255,255,255,0.2);
}

.pdf-content {
    background: #f8f9fa;
    padding: 20px;
}

.pdf-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pdf-icon {
    font-size: 48px;
    color: #e74c3c;
    flex-shrink: 0;
}

.pdf-details {
    flex: 1;
}

.pdf-details h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 18px;
}

.pdf-details p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.pdf-preview-container {
    position: relative;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.pdf-iframe {
    width: 100%;
    height: 500px;
    border: none;
    display: block;
}

.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    color: #666;
    z-index: 10;
}

.pdf-loading i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #3498db;
}

.pdf-actions {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.pdf-download-btn {
    display: inline-block;
    padding: 10px 25px;
    background: #2ecc71;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.pdf-download-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
}

/* Upload Section Improvements */
.upload-options {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.upload-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.upload-option:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.upload-option input[type="radio"] {
    display: none;
}

.upload-option input[type="radio"]:checked + * + * {
    color: #3498db;
    font-weight: bold;
}

.upload-option i {
    font-size: 24px;
    margin-bottom: 8px;
    color: #666;
}

.upload-option span {
    font-size: 14px;
    color: #666;
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(52, 152, 219, 0.05);
    margin-bottom: 20px;
}

.upload-area:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: #2980b9;
}

.upload-area.drag-over {
    background: rgba(52, 152, 219, 0.2);
    border-color: #1c5d87;
    transform: scale(1.02);
}

.upload-area i {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

/* File List Improvements */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.file-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.file-item .file-name {
    font-weight: 500;
    color: #2c3e50;
}

.file-item .file-size {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

.remove-file {
    background: #e74c3c;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s;
}

.remove-file:hover {
    background: #c0392b;
    transform: rotate(90deg);
}

/* File Link Container */
.file-link-container {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.file-link-container:hover {
    border-color: #3498db;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.1);
}

.file-link {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.3s;
}

.file-link:hover {
    color: #3498db;
}

.file-link i {
    font-size: 24px;
    color: #3498db;
}

.file-link-text {
    flex: 1;
}

.file-link-text strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
}

.file-link-text small {
    font-size: 12px;
    color: #666;
}

/* Sidebar Actions */
.sidebar-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.sidebar-actions .action-btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .custom-editor {
        width: 95%;
        height: 95vh;
    }
    
    .editor-toolbar {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    
    .toolbar-group {
        flex-wrap: wrap;
        border-right: none;
        margin-right: 0;
        padding-right: 0;
        margin-bottom: 10px;
    }
    
    .editor-sidebar {
        position: static;
        width: auto;
        margin: 10px;
    }
    
    .pdf-iframe {
        height: 300px;
    }
    
    .pdf-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .upload-options {
        flex-direction: column;
    }
    
    .pdf-download-btn {
        width: 100%;
        text-align: center;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .file-item span {
        display: flex;
        align-items: center;
    }
}