/* ============================================================
   ASEAC - PANEL DE ADMINISTRACIÓN Y REDACCIÓN DEL CATÁLOGO
   Estética Profesional Oscura · Paleta Zafiro & Ónice
   SIN COLORES NEÓN · SIN EMOJIS (Iconografía Font Awesome 6)
   ============================================================ */

:root {
    --adm-bg: #090d16;
    --adm-surface: #0f1523;
    --adm-surface-card: #141c2e;
    --adm-border: rgba(255, 255, 255, 0.08);
    --adm-border-active: rgba(59, 130, 246, 0.4);
    
    --adm-primary: #2563eb;
    --adm-primary-hover: #1d4ed8;
    --adm-primary-light: #60a5fa;
    --adm-success: #059669;
    --adm-danger: #dc2626;
    --adm-warning: #d97706;

    --adm-text: #f8fafc;
    --adm-text-muted: #94a3b8;
    --adm-text-dim: #64748b;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at 50% 0%, #172554 0%, #090d16 50%, #05070c 100%);
    background-attachment: fixed;
    color: var(--adm-text);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- BLOQUEO / LOGIN MODAL --- */
.auth-gate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 12, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-gate-card {
    background: #0f1524;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 18px;
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(37, 99, 235, 0.15);
    text-align: center;
}

.auth-gate-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-gate-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #ffffff;
}

.auth-gate-desc {
    font-size: 0.9rem;
    color: var(--adm-text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.auth-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus {
    border-color: var(--adm-primary-light);
}

.auth-btn-submit {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: all 0.2s;
}

.auth-btn-submit:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
}

.auth-error-msg {
    color: #f87171;
    font-size: 0.82rem;
    margin-top: 6px;
    display: none;
}

/* --- ADMIN HEADER --- */
.adm-header {
    background: rgba(15, 21, 35, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--adm-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.adm-nav {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adm-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.adm-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
}

.adm-brand-text {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #ffffff;
    font-family: var(--font-mono);
}

.adm-badge {
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.adm-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-adm {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.btn-adm-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
}

.btn-adm-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-adm-ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--adm-border);
    color: var(--adm-text-muted);
}

.btn-adm-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-adm-danger {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #f87171;
}

.btn-adm-danger:hover {
    background: rgba(220, 38, 38, 0.25);
}

/* --- MAIN CONTAINER --- */
.adm-main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    width: 100%;
    flex: 1;
}

/* --- STATS BAR --- */
.adm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.adm-stat-card {
    background: var(--adm-surface-card);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.adm-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #93c5fd;
    font-size: 1.25rem;
}

.adm-stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
}

.adm-stat-lbl {
    font-size: 0.78rem;
    color: var(--adm-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- WORKSPACE: EDITOR & LIST GRID --- */
.adm-workspace {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .adm-workspace {
        grid-template-columns: 1fr;
    }
}

.adm-card {
    background: var(--adm-surface-card);
    border: 1px solid var(--adm-border);
    border-radius: 14px;
    padding: 24px;
}

.adm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--adm-border);
}

.adm-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.adm-card-title i {
    color: var(--adm-primary-light);
}

/* --- FORMULARIO DE EDICIÓN --- */
.adm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
}

.form-control {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--adm-primary-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 140px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Barra de herramientas para insertar código / LaTeX */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--adm-border);
}

.tool-snip-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--adm-border);
    color: var(--adm-text-muted);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
}

.tool-snip-btn:hover {
    background: rgba(37, 99, 235, 0.25);
    color: #ffffff;
    border-color: var(--adm-primary-light);
}

/* Caja de previsualización en vivo */
.preview-card {
    background: rgba(9, 13, 22, 0.6);
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 16px;
    min-height: 100px;
    max-height: 240px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Checkbox destinos de publicación */
.destinos-group {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
}

.dest-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: #e2e8f0;
}

.dest-check-label input {
    cursor: pointer;
}

/* --- TABLA / LISTA DE ARTÍCULOS --- */
.published-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 680px;
    overflow-y: auto;
    padding-right: 4px;
}

.pub-item-card {
    background: rgba(15, 21, 35, 0.75);
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s;
}

.pub-item-card:hover {
    border-color: var(--adm-border-active);
}

.pub-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pub-item-materia {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--adm-primary-light);
    font-weight: 700;
}

.pub-badges-wrap {
    display: flex;
    gap: 6px;
}

.badge-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.badge-tag--cat { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
.badge-tag--pres { background: rgba(5, 150, 105, 0.2); color: #34d399; }

.pub-item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.35;
}

.pub-item-resumen {
    font-size: 0.8rem;
    color: var(--adm-text-muted);
    line-height: 1.45;
}

.pub-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--adm-border);
}

.btn-mini {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--adm-border);
    background: transparent;
    color: var(--adm-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-mini:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.btn-mini--danger:hover {
    color: #f87171;
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
}

/* Empty state */
.adm-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--adm-text-dim);
}

.adm-empty i {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.15);
}
