/* Rich Text Editor Styles */
.rich-editor-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.rich-editor-toolbar {
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    padding-right: 0.75rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: var(--portal-primary);
}

.toolbar-btn.active {
    background: var(--portal-primary);
    color: white;
    border-color: var(--portal-primary);
}

.toolbar-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    padding: 0.5rem;
    font-size: 0.9rem;
    min-width: 120px;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: rgba(255, 255, 255, 0.15);
}

.toolbar-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 80px;
}

.toolbar-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: rgba(255, 255, 255, 0.15);
}

.color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.color-picker {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.rich-editor-content {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    color: white;
    font-size: 1rem;
    line-height: 1.8; /* Aumentar el interlineado para mejor legibilidad */
    outline: none;
    background: transparent;
    white-space: pre-wrap; /* Preservar espacios en blanco y saltos de línea */
    word-wrap: break-word; /* Permitir que las palabras largas se rompan */
}

.rich-editor-content:focus {
    background: rgba(255, 255, 255, 0.02);
}

/* Content styling */
.rich-editor-content h1,
.rich-editor-content h2,
.rich-editor-content h3,
.rich-editor-content h4,
.rich-editor-content h5,
.rich-editor-content h6 {
    color: var(--portal-primary);
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
}

.rich-editor-content h1 { font-size: 2rem; }
.rich-editor-content h2 { font-size: 1.75rem; }
.rich-editor-content h3 { font-size: 1.5rem; }
.rich-editor-content h4 { font-size: 1.25rem; }
.rich-editor-content h5 { font-size: 1.1rem; }
.rich-editor-content h6 { font-size: 1rem; }

.rich-editor-content p {
    margin: 0.75rem 0;
    min-height: 1.6em; /* Asegurar altura mínima para párrafos vacíos */
}

/* Mejorar visualización de saltos de línea */
.rich-editor-content br {
    display: block;
    margin: 1em 0;
    height: 1em;
    line-height: 1em;
    content: "";
}

/* Hacer que los saltos de línea sean más visibles con un borde sutil */
.rich-editor-content br::after {
    content: "";
    display: block;
    height: 1em;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Mejorar espaciado entre elementos después de br */
.rich-editor-content br + p,
.rich-editor-content br + div,
.rich-editor-content br + span,
.rich-editor-content br + * {
    margin-top: 1em;
}

/* Asegurar que múltiples br consecutivos se vean correctamente */
.rich-editor-content br + br {
    margin-top: 0.5em;
}

/* Párrafos vacíos deben ser visibles */
.rich-editor-content p:empty {
    min-height: 1.6em;
}

.rich-editor-content p:empty::before {
    content: "\200B"; /* Zero-width space para mantener el párrafo visible */
}

/* Asegurar que los divs también manejen saltos de línea correctamente */
.rich-editor-content div {
    min-height: 1.6em;
}

.rich-editor-content div:empty::before {
    content: "\200B";
}

.rich-editor-content ul,
.rich-editor-content ol {
    margin: 0.75rem 0;
    padding-left: 2rem;
}

.rich-editor-content li {
    margin: 0.25rem 0;
}

.rich-editor-content blockquote {
    border-left: 4px solid var(--portal-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
}

.rich-editor-content a {
    color: var(--portal-primary);
    text-decoration: underline;
}

.rich-editor-content a:hover {
    color: var(--portal-secondary);
}

.rich-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.rich-editor-content video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.rich-editor-content .video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 1rem 0;
    border-radius: 8px;
}

.rich-editor-content .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.rich-editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.rich-editor-content th,
.rich-editor-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-editor-content th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: var(--portal-primary);
}

/* Modal styles for media insertion */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.media-modal-content {
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.media-modal-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.media-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.media-modal-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.media-form-group {
    margin-bottom: 1.5rem;
}

.media-form-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.media-form-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
}

.media-form-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: rgba(255, 255, 255, 0.15);
}

.media-form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    resize: vertical;
}

.media-form-textarea:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: rgba(255, 255, 255, 0.15);
}

.media-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.media-btn-primary {
    background: var(--portal-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.media-btn-primary:hover {
    background: var(--portal-secondary);
    transform: translateY(-2px);
}

.media-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.media-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Preview styles */
.media-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-preview img,
.media-preview video {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Responsive design */
@media (max-width: 768px) {
    .rich-editor-toolbar {
        padding: 0.5rem;
        gap: 0.25rem;
    }
    
    .toolbar-group {
        padding-right: 0.5rem;
    }
    
    .toolbar-btn {
        min-width: 32px;
        height: 32px;
        padding: 0.25rem;
        font-size: 0.8rem;
    }
    
    .toolbar-select,
    .toolbar-input {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    .toolbar-select {
        min-width: 100px;
    }
    
    .toolbar-input {
        width: 60px;
    }
    
    .rich-editor-content {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .media-modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .media-form-actions {
        flex-direction: column;
    }
}

/* Dark scrollbar for editor content */
.rich-editor-content::-webkit-scrollbar {
    width: 8px;
}

.rich-editor-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.rich-editor-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.rich-editor-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Estil
os adicionales para el modal de noticias */
.modal.extra-large .modal-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.news-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(var(--portal-primary-rgb), 0.1);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.form-help {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.field-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-error::before {
    content: "⚠";
    font-size: 0.9rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: transparent;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--portal-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--portal-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--portal-primary-rgb), 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.create-news-btn {
    margin-top: 1.5rem;
    align-self: flex-start;
}

/* Responsive para el formulario */
@media (max-width: 768px) {
    .modal.extra-large .modal-content {
        width: 98%;
        margin: 1rem;
        max-height: 95vh;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .rich-editor-toolbar {
        flex-wrap: wrap;
    }
    
    .toolbar-group {
        margin-bottom: 0.5rem;
    }
}

/* Estilos para el contador de caracteres */
.character-counter {
    text-align: right;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.character-counter.warning {
    color: #f59e0b;
}

.character-counter.error {
    color: #ef4444;
}

/* Estilos para preview de imagen */
.image-preview {
    margin-top: 0.5rem;
    max-width: 200px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animaciones para el editor */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rich-editor-container {
    animation: fadeIn 0.3s ease-out;
}

/* Estilos para el modo código fuente */
.rich-editor-content pre {
    background: #1a1a1a !important;
    color: #00ff00 !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Mejoras para la accesibilidad */
.toolbar-btn:focus,
.toolbar-select:focus,
.toolbar-input:focus,
.color-picker:focus {
    outline: 2px solid var(--portal-primary);
    outline-offset: 2px;
}

/* Estilos para tooltips mejorados */
.toolbar-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.toolbar-btn {
    position: relative;
}