/* ==========================================================
   Panel de Novedades FJA
   ========================================================== */
:root {
    --fja-navy: #0a192f;
    --fja-navy-2: #112240;
    --fja-blue: #005691;
    --fja-sky: #38bdf8;
    --panel-bg: #f4f7f9;
    --panel-border: #e3e8ee;
    --sidebar-w: 260px;
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1f2937;
    background: var(--panel-bg);
}
.x-small { font-size: .72rem; }
.min-w-0 { min-width: 0; }

/* ---------------- Login ---------------- */
.login-page {
    min-height: 100vh;
    background:
        linear-gradient(160deg, rgba(10, 25, 47, .88), rgba(0, 86, 145, .75)),
        var(--login-bg) center/cover no-repeat fixed;
}
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}
.login-card {
    width: 100%;
    max-width: 410px;
    background: #fff;
    border-radius: 16px;
    padding: 2.25rem 2rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
    border-top: 4px solid var(--fja-blue);
}
.login-logo {
    width: 76px; height: 76px;
    border-radius: 50%;
    border: 3px solid #e9eef4;
}

/* ---------------- Layout ---------------- */
.panel-layout { display: flex; min-height: 100vh; }

.panel-sidebar {
    width: var(--sidebar-w);
    background: var(--fja-navy) !important;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
@media (min-width: 992px) {
    .panel-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
    }
}
.panel-sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); }

.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.15rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-logo {
    width: 42px; height: 42px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .25);
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem .65rem;
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .4);
    padding: 1rem .75rem .35rem;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: .7rem;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    padding: .6rem .8rem;
    border-radius: 8px;
    font-size: .93rem;
    transition: background .15s, color .15s;
}
.sidebar-nav a i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, .18), rgba(56, 189, 248, .04));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--fja-sky);
}
.sidebar-user {
    display: flex; align-items: center; gap: .7rem;
    padding: 1rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--fja-blue); color: #fff; font-weight: 700;
    flex-shrink: 0;
}

.panel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: .75rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--panel-border);
    padding: .8rem 1.5rem;
    min-height: 64px;
}
.panel-title { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--fja-navy); }
.panel-view { padding: 1.5rem; flex: 1; }
@media (max-width: 576px) {
    .panel-view { padding: 1rem; }
    .panel-topbar { padding: .65rem 1rem; }
    .panel-title { font-size: 1.05rem; }
}

/* ---------------- Componentes ---------------- */
.card-panel {
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-panel > .card-header {
    background: transparent;
    border-bottom: 1px solid var(--panel-border);
    padding: .85rem 1.1rem;
    font-weight: 600;
    display: flex; align-items: center; gap: .5rem;
}
.card-panel > .card-body { padding: 1.1rem; }

.stat-card { padding: 1.15rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--fja-navy); }
.stat-label { font-size: .8rem; color: #6b7280; }

.table-news td { vertical-align: middle; }
.table-news .thumb {
    width: 64px; height: 46px; object-fit: cover; border-radius: 6px; background: #e5e7eb;
}
.thumb-empty {
    width: 64px; height: 46px; border-radius: 6px; background: #eef2f6;
    display: grid; place-items: center; color: #9ca3af;
}
.news-title-cell { min-width: 220px; }
.news-title-cell a { color: var(--fja-navy); font-weight: 600; text-decoration: none; }
.news-title-cell a:hover { color: var(--fja-blue); }

.badge-status { font-weight: 600; padding: .38em .7em; }
.badge-publicado { background: #dcfce7; color: #166534; }
.badge-programado { background: #e0f2fe; color: #075985; }
.badge-borrador { background: #f3f4f6; color: #4b5563; }
.cat-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #6b7280; }
.empty-state i { font-size: 2.6rem; color: #cbd5e1; display: block; margin-bottom: .5rem; }

.confirm-icon {
    width: 64px; height: 64px; margin: 0 auto; border-radius: 50%;
    background: #fee2e2; color: #dc2626; font-size: 1.8rem;
    display: grid; place-items: center;
}

/* ---------------- Editor de novedad ---------------- */
.editor-title-input {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--fja-navy);
    border: 0;
    padding: .25rem 0;
    box-shadow: none !important;
    background: transparent;
}
.editor-title-input::placeholder { color: #b6c0cc; }
.editor-summary {
    resize: vertical;
    border-radius: 8px;
}

.quill-wrap { position: relative; }
.quill-wrap .ql-toolbar.ql-snow {
    position: sticky;
    top: 64px;
    z-index: 10;
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-radius: 10px 10px 0 0;
    padding: .55rem;
}
.quill-wrap .ql-container.ql-snow {
    border: 1px solid var(--panel-border);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #fff;
    font-family: inherit;
}
.quill-wrap .ql-editor {
    min-height: 460px;
    padding: 1.5rem 1.75rem;
}
.quill-wrap .ql-editor.ql-blank::before { font-style: normal; color: #9aa5b1; left: 1.75rem; }
.quill-wrap .ql-editor.news-content ol { padding-left: 0; }
.quill-wrap .ql-editor.news-content li { margin-bottom: .2rem; }
.quill-wrap .ql-editor img { cursor: pointer; }
.quill-wrap .ql-editor img.is-selected { outline: 3px solid var(--fja-sky); outline-offset: 2px; }
.quill-wrap .ql-snow .ql-tooltip { z-index: 30; border-radius: 8px; }
.quill-wrap .ql-snow .ql-tooltip[data-mode=video]::before { content: "URL de YouTube / Vimeo / Mapa:"; }
.quill-wrap .ql-snow .ql-tooltip[data-mode=link]::before { content: "Enlace:"; }
.quill-wrap .ql-snow .ql-tooltip::before { content: "Visitar:"; }
.quill-wrap .ql-snow .ql-tooltip a.ql-action::after { content: "Editar"; }
.quill-wrap .ql-snow .ql-tooltip a.ql-remove::before { content: "Quitar"; }
.quill-wrap .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Guardar"; }
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-label::before,
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: "Normal"; }
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: "Título"; }
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: "Subtítulo"; }
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
.quill-wrap .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before { content: "Destacado"; }
.quill-wrap .ql-uploading {
    position: absolute; inset: 0; z-index: 20;
    background: rgba(255, 255, 255, .7);
    display: grid; place-items: center;
    border-radius: 10px;
    font-weight: 600; color: var(--fja-blue);
}

/* Barra flotante para imágenes del texto */
.img-toolbar {
    position: absolute;
    z-index: 25;
    display: flex; flex-wrap: wrap; gap: 4px;
    background: var(--fja-navy);
    padding: 6px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    max-width: calc(100% - 16px);
}
.img-toolbar button {
    border: 0; background: transparent; color: #e2e8f0;
    padding: 5px 9px; border-radius: 6px; font-size: .82rem; line-height: 1.2;
}
.img-toolbar button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.img-toolbar button.active { background: var(--fja-blue); color: #fff; }
.img-toolbar .sep { width: 1px; background: rgba(255, 255, 255, .2); margin: 2px 3px; }

/* Barra lateral del editor */
.editor-side { position: sticky; top: 80px; }
@media (max-width: 1199px) { .editor-side { position: static; } }

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 1.1rem;
    text-align: center;
    color: #64748b;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: .88rem;
    background: #fafcfe;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--fja-blue); background: #eef6fc; color: var(--fja-blue); }
.dropzone i { font-size: 1.6rem; display: block; margin-bottom: .25rem; }

.cover-preview {
    position: relative; border-radius: 10px; overflow: hidden;
    aspect-ratio: 16 / 9; background: #e5e7eb;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview .actions {
    position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .6rem;
}
.gallery-item {
    position: relative;
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
}
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery-item input {
    border: 0; border-top: 1px solid var(--panel-border);
    font-size: .75rem; padding: .3rem .45rem; width: 100%;
}
.gallery-item .remove, .gallery-item .insert {
    position: absolute; top: 4px;
    width: 26px; height: 26px; border-radius: 50%;
    border: 0; display: grid; place-items: center; font-size: .8rem;
    opacity: .92;
}
.gallery-item .remove { right: 4px; background: #dc2626; color: #fff; }
.gallery-item .insert { left: 4px; background: #fff; color: var(--fja-blue); }
.sortable-ghost { opacity: .35; }

.attach-item, .link-item {
    display: flex; align-items: center; gap: .6rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: .5rem .6rem;
    background: #fff;
    margin-bottom: .5rem;
}
.attach-item .drag, .link-item .drag { cursor: grab; color: #9ca3af; }
.file-ico {
    width: 34px; height: 34px; border-radius: 6px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 1.1rem;
    background: #eef2ff; color: #4338ca;
}
.file-ico.pdf { background: #fee2e2; color: #b91c1c; }
.file-ico.doc, .file-ico.docx { background: #dbeafe; color: #1d4ed8; }
.file-ico.xls, .file-ico.xlsx, .file-ico.csv { background: #dcfce7; color: #15803d; }

.upload-progress { height: 4px; }

.form-switch-lg .form-check-input { width: 2.4em; height: 1.3em; }

.save-bar {
    position: sticky; bottom: 0; z-index: 15;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--panel-border);
    padding: .75rem 1rem;
    margin: 1.5rem -1.5rem -1.5rem;
    display: none;
}
@media (max-width: 1199px) { .save-bar { display: flex; gap: .5rem; } }
@media (max-width: 576px) { .save-bar { margin: 1rem -1rem -1rem; } }

.dirty-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #f59e0b; margin-left: .4rem; vertical-align: middle;
}

.color-input { width: 48px; height: 38px; padding: 4px; }
