/* ========================================== */
/* PANEL DE NOTICIAS - ESTILOS                 */
/* ========================================== */

.noticias-panel-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.noticias-panel-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(43, 26, 30, 0.9), rgba(58, 33, 37, 0.9));
    border: 2px solid #ffd700;
    border-radius: 15px;
}

.noticias-panel-header h1 {
    color: #ffd700;
    margin: 0 0 10px 0;
    font-size: 2rem;
}

.noticias-panel-subtitle {
    color: #aaa;
    margin: 0;
}

/* ========================================== */
/* TOOLBAR                                     */
/* ========================================== */
.noticias-panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    flex-wrap: wrap;
}

.noticias-panel-filtros {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filtro {
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.4);
    color: #ffd700;
    border: 2px solid #8B0000;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-filtro:hover {
    border-color: #ffd700;
}

.btn-filtro.active {
    background: linear-gradient(180deg, #ffd700 0%, #e6c200 100%);
    color: #2c1a1d;
    border-color: #8B0000;
}

.btn-nueva-noticia {
    padding: 12px 24px;
    background: linear-gradient(180deg, #ffd700 0%, #e6c200 100%);
    color: #2c1a1d;
    border: 2px solid #8B0000;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-nueva-noticia:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* ========================================== */
/* LISTA DE NOTICIAS                           */
/* ========================================== */
.noticias-panel-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-noticia-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(43, 26, 30, 0.9), rgba(58, 33, 37, 0.9));
    border: 2px solid #8B0000;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.panel-noticia-item:hover {
    border-color: #ffd700;
    transform: translateX(3px);
}

.panel-noticia-info {
    flex: 1;
    min-width: 250px;
}

.panel-noticia-titulo {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.panel-noticia-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 12px;
}

.badge-estado {
    padding: 3px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 11px;
}

.badge-estado.publicada {
    background: rgba(0, 200, 0, 0.2);
    color: #66ff66;
    border: 1px solid #66ff66;
}

.badge-estado.borrador {
    background: rgba(255, 165, 0, 0.2);
    color: #ffaa00;
    border: 1px solid #ffaa00;
}

.badge-categoria {
    padding: 3px 10px;
    border-radius: 15px;
    background: var(--cat-color, #4a90e2);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
}

.panel-noticia-fecha {
    color: #aaa;
}

.panel-noticia-meta code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 5px;
    color: #ffd700;
    font-size: 11px;
}

.panel-noticia-acciones {
    display: flex;
    gap: 8px;
}

.btn-accion {
    width: 40px;
    height: 40px;
    border: 2px solid #8B0000;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-accion:hover {
    transform: scale(1.1);
    border-color: #ffd700;
}

.btn-accion.activo {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

.btn-borrar:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: #ff4444;
}

/* ========================================== */
/* ESTADOS                                     */
/* ========================================== */
.panel-vacio,
.panel-error {
    text-align: center;
    padding: 50px 20px;
    color: #aaa;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 2px solid #8B0000;
}

.panel-error {
    color: #ff6666;
    border-color: #ff4444;
}

.panel-error h3 {
    margin-top: 0;
    color: #ff6666;
}

/* ========================================== */
/* FORMULARIO                                  */
/* ========================================== */
.noticias-panel-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.noticias-panel-form-header h2 {
    color: #ffd700;
    margin: 0;
}

.btn-cancelar-form {
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.4);
    color: #ffd700;
    border: 2px solid #8B0000;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-cancelar-form:hover {
    border-color: #ffd700;
}

.noticias-panel-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.noticias-panel-form-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Campos del formulario */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #ffd700;
    font-weight: bold;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #8B0000;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ffd700;
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

.form-group small {
    color: #aaa;
    font-size: 11px;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.form-group-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ffd700;
}

/* Ayuda BBCode */
.panel-contenido-help {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin-bottom: 5px;
}

.panel-contenido-help span {
    padding: 3px 8px;
    background: rgba(139, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 11px;
    color: #ffd700;
    font-family: monospace;
}

/* ========================================== */
/* IMAGEN - TABS                               */
/* ========================================== */
.panel-imagen-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.tab-imagen {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    color: #ffd700;
    border: 2px solid #8B0000;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.tab-imagen.active {
    background: rgba(139, 0, 0, 0.5);
    border-bottom-color: #ffd700;
}

.panel-imagen-tab-content {
    margin-bottom: 10px;
}

/* Drop zone */
.panel-drop-zone {
    border: 2px dashed #8B0000;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
}

.panel-drop-zone:hover,
.panel-drop-zone.drag-over {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.05);
}

.panel-drop-zone.subiendo {
    opacity: 0.5;
    pointer-events: none;
}

.panel-drop-zone-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.drop-icon {
    font-size: 2.5rem;
}

.drop-text {
    color: #ffd700;
    font-weight: bold;
}

.drop-subtext,
.drop-info {
    color: #aaa;
    font-size: 12px;
}

/* Preview imagen */
.panel-imagen-preview {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    text-align: center;
}

.panel-imagen-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid #8B0000;
}

.btn-quitar-imagen {
    display: block;
    margin: 10px auto 0;
    padding: 6px 15px;
    background: rgba(139, 0, 0, 0.7);
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

/* ========================================== */
/* ACCIONES DEL FORMULARIO                     */
/* ========================================== */
.panel-form-acciones {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn-guardar-noticia {
    flex: 2;
    padding: 14px;
    background: linear-gradient(180deg, #ffd700 0%, #e6c200 100%);
    color: #2c1a1d;
    border: 2px solid #8B0000;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-guardar-noticia:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.btn-cancelar-form-secundario {
    flex: 1;
    padding: 14px;
    background: rgba(0, 0, 0, 0.4);
    color: #ffd700;
    border: 2px solid #8B0000;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-cancelar-form-secundario:hover {
    border-color: #ffd700;
}

/* ========================================== */
/* PREVIEW EN VIVO                             */
/* ========================================== */
.noticias-panel-preview-col {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.panel-preview-header {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
    border: 2px solid #8B0000;
    border-bottom: none;
}

.panel-preview-header h3 {
    color: #ffd700;
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.panel-preview-header small {
    color: #aaa;
    font-size: 11px;
}

.panel-preview {
    padding: 20px;
    background: rgba(43, 26, 30, 0.9);
    border: 2px solid #8B0000;
    border-radius: 0 0 12px 12px;
    min-height: 300px;
}

.preview-noticia {
    color: #e0e0e0;
}

.preview-titulo {
    color: #ffd700;
    font-size: 1.5rem;
    margin: 15px 0;
    line-height: 1.3;
}

.preview-imagen {
    margin: 15px 0;
    border-radius: 10px;
    overflow: hidden;
}

.preview-imagen img {
    width: 100%;
    border-radius: 10px;
}

.preview-contenido {
    color: #e0e0e0;
    line-height: 1.6;
    font-size: 14px;
}

.preview-contenido p {
    margin: 0 0 12px 0;
}

.preview-contenido img {
    max-width: 100%;
    border-radius: 8px;
}

.preview-contenido a {
    color: #ffd700;
    text-decoration: underline;
}

.preview-contenido blockquote {
    border-left: 4px solid #ffd700;
    padding: 10px 15px;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

/* ========================================== */
/* RESPONSIVE                                  */
/* ========================================== */
@media (max-width: 900px) {
    .noticias-panel-form-grid {
        grid-template-columns: 1fr;
    }

    .noticias-panel-preview-col {
        position: static;
        max-height: none;
    }

    .noticias-panel-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .noticias-panel-filtros {
        justify-content: center;
    }

    .btn-nueva-noticia {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .panel-noticia-item {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-noticia-acciones {
        justify-content: flex-end;
    }

    .form-row-2col {
        grid-template-columns: 1fr;
    }

    .panel-form-acciones {
        flex-direction: column;
    }

    .noticias-panel-container {
        padding: 10px;
    }

    .noticias-panel-header h1 {
        font-size: 1.5rem;
    }
}
/* ========================================== */
/* BARRA DE BOTONES BBCode                     */
/* ========================================== */
.panel-bbcode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8B0000;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    align-items: center;
}

.bbcode-btn {
    min-width: 40px;
    height: 36px;
    padding: 0 10px;
    background: linear-gradient(180deg, #3a2125 0%, #2c1a1d 100%);
    color: #ffd700;
    border: 2px solid #8B0000;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbcode-btn:hover {
    background: linear-gradient(180deg, #ffd700 0%, #e6c200 100%);
    color: #2c1a1d;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 215, 0, 0.3);
}

.bbcode-separator {
    color: #8B0000;
    font-weight: bold;
    padding: 0 4px;
    user-select: none;
}

.bbcode-color-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
}

.bbcode-color-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.bbcode-color-label {
    color: #ffd700;
    font-size: 14px;
    margin: 0 4px;
    user-select: none;
}

/* Textarea pegado a la barra */
.form-group textarea#panel-contenido {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

/* Galería de imágenes en el panel */
.panel-galeria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); /* Cuadrícula automática */
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid #8B0000;
}

.panel-galeria img {
    width: 100%;
    aspect-ratio: 1 / 1; /* 👈 Fuerza a que sean cuadradas */
    object-fit: cover;   /* 👈 Recorta la imagen para que llene el cuadrado */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    display: block;
}

.panel-galeria img:hover {
    border-color: #ffd700;
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}