:root {
    --glass-bg: rgba(20, 24, 34, 0.55);
    --glass-bg-light: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.14);
    --accent: #c9a24b;
    --text: #f2f0ea;
    --text-dim: #c7c4ba;
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: linear-gradient(rgba(8, 10, 16, 0.72), rgba(8, 10, 16, 0.82)), url('/static/img/fondo.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
}

a { color: inherit; text-decoration: none; }

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* Header */

.portada-row {
    display: flex;
    justify-content: center;
    padding: 1rem;
    margin: 1rem 1rem 0;
    border-radius: var(--radius);
}

.portada-banner {
    display: block;
    max-width: 100%;
    height: auto;
    width: 640px;
    border-radius: 10px;
}

.menu-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    margin: 0.8rem 1rem 1rem;
    border-radius: var(--radius);
}

.menu-links {
    display: flex;
    gap: 2.2rem;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.menu-links a {
    padding: 0.55rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Usuario panel */

.usuario-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem 1.2rem;
    font-size: 0.85rem;
}

.usuario-nombre { font-weight: 500; }

.role-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.usuario-panel button {
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8rem;
}



/* Layout */

.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    grid-template-areas:
        ". usuario"
        "noticias noticias";
    gap: 1.2rem;
}

.usuario-slot { grid-area: usuario; }
.noticias-slot { grid-area: noticias; margin-bottom: 0; }

@media (max-width: 720px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "usuario" "noticias";
    }
}

section.block { margin-bottom: 2.5rem; }

.block h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    letter-spacing: 0.03em;
    margin: 0 0 1rem;
    padding-left: 0.2rem;
    border-left: 3px solid var(--accent);
    padding-left: 0.8rem;
}

/* Noticias grid */

.noticias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}

.noticia-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.noticia-card:hover { transform: translateY(-4px); }

.noticia-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center 20%;
}

.noticia-card .body { padding: 1rem 1.2rem 1.3rem; }

.noticia-card h3 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
}

.noticia-card p {
    color: var(--text-dim);
    font-size: 0.88rem;
    margin: 0 0 0.6rem;
}

.noticia-card .meta {
    font-size: 0.72rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.empty-note {
    color: var(--text-dim);
    font-size: 0.9rem;
    padding: 1.2rem;
}

/* Paginas list */

.pages-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.pages-list a {
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-size: 0.88rem;
}



/* Detail pages */

.detail-panel { padding: 2rem 2.2rem; }
.detail-panel > img { width: 100%; border-radius: 12px; margin-bottom: 1.2rem; }

/* Texto de páginas importadas */
.contenido { line-height: 1.7; }
.contenido p { margin: 0 0 1.1rem; text-align: justify; hyphens: auto; }
.contenido p.ta-center { text-align: center; }
.contenido p.ta-right { text-align: right; }
.contenido p.ta-left { text-align: left; }
.contenido img { max-width: 100%; height: auto; border-radius: 10px; }
.contenido img.aligncenter { display: block; margin: 0.6rem auto 1rem; }
.contenido img.alignleft { float: left; margin: 0.3rem 1.4rem 0.8rem 0; }
.contenido img.alignright { float: right; margin: 0.3rem 0 0.8rem 1.4rem; }
.contenido img.signo { display: block; width: 140px; height: auto; margin: 0 auto 1.4rem; border-radius: 0; filter: drop-shadow(0 0 12px rgba(201, 162, 75, 0.5)); }
.contenido::after { content: ""; display: block; clear: both; }
@media (max-width: 600px) { .contenido img.alignleft, .contenido img.alignright { float: none; display: block; margin: 0.6rem auto 1rem; } }
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.85rem;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.detail-panel iframe { display: block; width: 100%; max-width: 760px; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; margin: 1rem auto; }

.file-list { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.file-row {
    display: grid;
    grid-template-columns: 4rem 1fr auto auto;
    align-items: center;
    gap: 1.2rem;
    padding: 1.1rem 1.4rem;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: var(--glass-bg-light);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.file-ext { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); text-align: center; }
.file-name { overflow-wrap: anywhere; line-height: 1.4; }
.file-meta { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; }
.download-button {
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.82rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.menu-links a:hover,
.menu-links a:focus-visible,
.usuario-panel button:hover,
.usuario-panel button:focus-visible,
.back-link:hover,
.back-link:focus-visible,
.file-row:hover,
.file-row:focus-visible,
.page-child-card:hover,
.page-child-card:focus-visible,
.pages-list a:hover,
.pages-list a:focus-visible,
.noticia-card:hover,
.noticia-card:focus-visible {
    transform: translateX(6px);
    border-color: var(--accent);
    background: rgba(201, 162, 75, 0.14);
    color: #f6dc9b;
    outline: none;
    animation: file-glow 1.1s ease-in-out infinite;
}
.page-child-card:hover span, .pages-list a:hover, .noticia-card:hover h3 { color: #f6dc9b; }
.file-row:hover .download-button,
.file-row:focus-visible .download-button {
    background: var(--accent);
    color: #1a1206;
}

@keyframes file-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(201, 162, 75, 0.25), inset 0 0 0 rgba(201, 162, 75, 0); background-color: rgba(201, 162, 75, 0.10); }
    50%      { box-shadow: 0 0 22px rgba(201, 162, 75, 0.65), inset 0 0 18px rgba(201, 162, 75, 0.12); background-color: rgba(201, 162, 75, 0.22); }
}

@media (prefers-reduced-motion: reduce) {
    .file-row:hover, .file-row:focus-visible, .page-child-card:hover, .pages-list a:hover, .noticia-card:hover, .menu-links a:hover, .usuario-panel button:hover, .back-link:hover { animation: none; box-shadow: 0 0 14px rgba(201, 162, 75, 0.5); }
}
@media (max-width: 600px) {
    .file-row { grid-template-columns: 3rem 1fr; gap: 0.6rem 0.9rem; padding: 1rem; }
    .file-meta { display: none; }
    .download-button { grid-column: 2; justify-self: start; }
}

.drive-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
    padding: 0.7rem 1.3rem;
    border-radius: 999px;
    background: var(--accent);
    color: #1a1206;
    font-weight: 600;
    font-size: 0.9rem;
}

.drive-button:hover { opacity: 0.88; }

.page-icono {
    width: 110px !important;
    height: 110px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    display: block;
    margin: 0 auto 1rem;
}

.detail-panel h1 { text-align: center; }

/* Child pages grid (gold-letter icon navigation) */

.page-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1.4rem;
    margin-top: 2rem;
}

.page-child-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}



.page-child-card img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
}

.page-child-card span {
    font-size: 0.85rem;
    color: var(--text);
}

/* Login */

.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    padding: 1.5rem 1rem;
}

.login-banner {
    width: 100%;
    max-width: 760px;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.login-panel {
    width: 100%;
    max-width: 420px;
    padding: 2.2rem;
}

.login-panel h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.7rem;
    line-height: 1.25;
    text-align: center;
    margin: 0 0 0.4rem;
}

.login-subtitle {
    text-align: center;
    margin: 0 0 1.6rem;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.login-panel form p { margin: 0 0 1rem; }
.login-panel label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.3rem; }

.login-panel input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.9rem;
}

.login-panel button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.7rem;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #1a1206;
    font-weight: 600;
    cursor: pointer;
}

/* Primer ingreso */

.perfil-panel { max-width: 560px; }

.perfil-panel fieldset {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin: 0 0 1.3rem;
    padding: 1rem 1.2rem 0.4rem;
}

.perfil-panel legend {
    padding: 0 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.perfil-panel .opcional { text-transform: none; letter-spacing: 0; color: var(--text-dim); }

.perfil-panel .campo { margin-bottom: 1rem; }
.perfil-panel .campo label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.3rem; }
.perfil-panel .campo small { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-dim); }
.perfil-panel .error, .form-errors { display: block; margin-top: 0.3rem; font-size: 0.8rem; color: #ff9d8a; }
.form-errors { list-style: none; padding: 0; margin: 0 0 1rem; }

.perfil-panel input[type="email"],
.perfil-panel input[type="text"],
.perfil-panel input[type="date"],
.perfil-panel input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.9rem;
}

.perfil-panel input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 10px rgba(201, 162, 75, 0.4); }

.campo-mandil { display: flex; align-items: center; gap: 1rem; }
.campo-mandil img { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--glass-border); flex-shrink: 0; }
.campo-mandil > div { flex: 1; }

.reglas-clave { margin: 0 0 1rem; padding-left: 1.1rem; font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; }

.acciones-clave { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.mostrar-clave { font-size: 0.82rem; color: var(--text-dim); cursor: pointer; }
.aviso-clave { display: block; margin-bottom: 1rem; font-size: 0.78rem; color: var(--accent); }

.perfil-panel .btn-secundario {
    width: auto;
    margin: 0;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.82rem;
}
.perfil-panel .btn-secundario:hover { background: var(--accent); color: #1a1206; }

.salir-form { text-align: center; margin-top: 1rem; }
.btn-enlace { width: auto !important; background: none !important; color: var(--text-dim) !important; font-size: 0.8rem; font-weight: 400 !important; text-decoration: underline; }
