/* ============================================================
   CKEDITOR - ESTILOS PERSONALIZADOS PARA EC3SA
   Versión optimizada y alineada con la identidad corporativa
   ============================================================ */

/* ============================================================
   1. RESET Y BASE PARA EL EDITOR
   ============================================================ */

/* Reset básico para el contenido del editor */
.cke_editable {
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    line-height: 1.7;
    color: #1a1a1a;
    background: #ffffff;
    padding: 1.5rem;
}

/* Estilos para el contenido dentro del editor */
.cke_editable h1,
.cke_editable h2,
.cke_editable h3,
.cke_editable h4,
.cke_editable h5,
.cke_editable h6 {
    color: #0a0a1a;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

.cke_editable h1 { font-size: 2.2rem; }
.cke_editable h2 { font-size: 1.8rem; }
.cke_editable h3 { font-size: 1.5rem; }
.cke_editable h4 { font-size: 1.2rem; }
.cke_editable h5 { font-size: 1rem; }
.cke_editable h6 { font-size: 0.9rem; }

.cke_editable p {
    margin-bottom: 1.2rem;
}

.cke_editable a {
    color: #0066FF;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 102, 255, 0.2);
    transition: border-color 0.3s ease;
}

.cke_editable a:hover {
    border-bottom-color: #8B1A4A;
    color: #8B1A4A;
}

.cke_editable strong,
.cke_editable b {
    color: #0a0a1a;
    font-weight: 700;
}

.cke_editable em,
.cke_editable i {
    color: #1e293b;
}

.cke_editable ul,
.cke_editable ol {
    margin: 0 0 1.2rem 1.5rem;
    padding: 0;
}

.cke_editable ul li,
.cke_editable ol li {
    margin-bottom: 0.3rem;
    line-height: 1.6;
}

.cke_editable blockquote {
    border-left: 4px solid #0066FF;
    padding: 0.8rem 1.5rem;
    margin: 1.2rem 0;
    background: #f5f7fe;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #1e293b;
}

.cke_editable blockquote p:last-child {
    margin-bottom: 0;
}

.cke_editable code {
    background: #f3f3f3;
    border: 1px solid #e0e5f0;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #8B1A4A;
}

.cke_editable pre {
    background: #f7f9fc;
    border: 1px solid #e0e5f0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #1a1a1a;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cke_editable img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e0e5f0;
}

.cke_editable table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.cke_editable table th,
.cke_editable table td {
    border: 1px solid #e0e5f0;
    padding: 0.6rem 1rem;
    text-align: left;
}

.cke_editable table th {
    background: #f5f7fe;
    color: #0a0a1a;
    font-weight: 600;
}

.cke_editable table tr:nth-child(even) {
    background: #fafcff;
}

/* ============================================================
   2. ESTILOS PARA EL MODO INLINE
   ============================================================ */

.cke_editable.cke_editable_inline {
    cursor: pointer;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.cke_editable.cke_editable_inline.cke_focus {
    box-shadow: inset 0 0 0 2px #0066FF, 0 0 20px rgba(0, 102, 255, 0.08);
    outline: none;
    background: #ffffff;
    cursor: text;
}

/* ============================================================
   3. ESTILOS PARA EL PANEL DE HERRAMIENTAS (TOOLBAR)
   ============================================================ */

/* Personalización del toolbar de CKEditor */
.cke_top {
    background: #f7f9fc !important;
    border-bottom: 1px solid #e0e5f0 !important;
    padding: 6px 8px !important;
    border-radius: 8px 8px 0 0 !important;
}

.cke_bottom {
    background: #f7f9fc !important;
    border-top: 1px solid #e0e5f0 !important;
    padding: 6px 8px !important;
    border-radius: 0 0 8px 8px !important;
}

.cke_toolgroup {
    border: 1px solid #e0e5f0 !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    margin: 0 4px !important;
}

.cke_toolgroup:hover {
    border-color: #0066FF !important;
}

.cke_button {
    border-radius: 3px !important;
    transition: background 0.2s ease !important;
}

.cke_button:hover {
    background: #eef3ff !important;
}

.cke_button_on {
    background: #0066FF !important;
    border-color: #0066FF !important;
}

.cke_button_on .cke_button_icon {
    filter: brightness(0) invert(1) !important;
}

.cke_button_disabled {
    opacity: 0.4 !important;
}

/* ============================================================
   4. BOTÓN DE SUBIR ARCHIVO PERSONALIZADO
   ============================================================ */

.cke_button_upload {
    background: #0066FF !important;
    color: #fff !important;
    border-radius: 4px !important;
    padding: 4px 12px !important;
    font-weight: 600 !important;
    transition: background 0.3s ease !important;
}

.cke_button_upload:hover {
    background: #0044CC !important;
}

/* ============================================================
   5. RESPONSIVE PARA EL EDITOR
   ============================================================ */

@media (max-width: 768px) {
    .cke_editable {
        font-size: 14px;
        padding: 1rem;
    }

    .cke_editable h1 { font-size: 1.8rem; }
    .cke_editable h2 { font-size: 1.5rem; }
    .cke_editable h3 { font-size: 1.2rem; }
    .cke_editable h4 { font-size: 1rem; }

    .cke_top,
    .cke_bottom {
        padding: 4px !important;
    }

    .cke_toolgroup {
        margin: 0 2px !important;
    }

    .cke_button {
        padding: 2px 6px !important;
    }
}

@media (max-width: 480px) {
    .cke_editable {
        font-size: 13px;
        padding: 0.8rem;
    }

    .cke_editable h1 { font-size: 1.5rem; }
    .cke_editable h2 { font-size: 1.2rem; }
    .cke_editable h3 { font-size: 1rem; }

    .cke_top,
    .cke_bottom {
        padding: 2px !important;
        flex-wrap: wrap !important;
    }

    .cke_toolgroup {
        margin: 2px !important;
        padding: 2px !important;
    }

    .cke_button {
        padding: 2px 4px !important;
        font-size: 11px !important;
    }

    .cke_button_icon {
        width: 16px !important;
        height: 16px !important;
    }
}

/* ============================================================
   6. MODOS OSCURO Y CLARO (Soporte para tema)
   ============================================================ */

/* Tema claro (por defecto) */
.cke_editable {
    color: #1a1a1a;
    background: #ffffff;
}

/* Tema oscuro (soporte básico) */
.cke_editable.cke_editable_dark {
    color: #f0f4fa;
    background: #0a0a1a;
}

.cke_editable.cke_editable_dark a {
    color: #93c5fd;
    border-bottom-color: rgba(147, 197, 253, 0.2);
}

.cke_editable.cke_editable_dark a:hover {
    color: #fca5a5;
    border-bottom-color: #fca5a5;
}

.cke_editable.cke_editable_dark blockquote {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #93c5fd;
    color: #e2e8f0;
}

.cke_editable.cke_editable_dark code {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fca5a5;
}

.cke_editable.cke_editable_dark pre {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.cke_editable.cke_editable_dark table th {
    background: rgba(255, 255, 255, 0.06);
    color: #f0f4fa;
}

.cke_editable.cke_editable_dark table td {
    border-color: rgba(255, 255, 255, 0.08);
}

.cke_editable.cke_editable_dark table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Toolbar oscuro */
.cke_editable_dark .cke_top,
.cke_editable_dark .cke_bottom {
    background: #1a1a3a !important;
    border-color: #2a2a5a !important;
}

.cke_editable_dark .cke_toolgroup {
    background: #0a0a1a !important;
    border-color: #2a2a5a !important;
}

.cke_editable_dark .cke_button {
    color: #b8cde0 !important;
}

.cke_editable_dark .cke_button:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.cke_editable_dark .cke_button_on {
    background: #0066FF !important;
}