/* ============================================
   Sistema Liber - Estilos BASE
   ============================================
   Este archivo define la estructura y layout SIN colores fijos.
   Los colores los define el TEMA activo (style-azul.css, style-rojo.css...)
   usando variables CSS. Si no hay tema, se usan los valores por defecto.
   ============================================ */

/* ---------- VARIABLES DE TEMA (valores por defecto = azul) ----------
   El archivo style-azul.css (o el tema activo) sobrescribe estas variables. */
:root {
    --tema: #1d4ed8;
    --tema-rgb: 29, 78, 216;
    --tema-hover: #1e40af;
    --tema-oscuro: #1e3a8a;
    --tema-claro: #eef2ff;
    --tema-border: #c0cdfd;
    --tema-sombra: rgba(29, 78, 216, 0.35);

    /* Mapeo a Bootstrap 5 */
    --bs-primary: var(--tema);
    --bs-primary-rgb: var(--tema-rgb);
    --bs-link-color: var(--tema);
    --bs-link-hover-color: var(--tema-hover);
    --bs-emphasis-color: var(--tema-oscuro);
    --bs-btn-hover-bg: var(--tema-hover);
    --bs-btn-bg: var(--tema);
    --bs-btn-border-color: var(--tema);
}

body {
    background-color: #f8f9fa;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   LANDING PROMOCIONAL
   ============================================ */

/* Tipografía */
.hero-titulo {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.hero-subtitulo,
.hero-descripcion {
    font-family: 'Inter', system-ui, sans-serif;
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
}

.hero-icon {
    font-size: 3.5rem;
    opacity: 0.9;
}

.hero-descripcion {
    max-width: 640px;
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Documentos canónicos */
.doc-tarjeta {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.doc-tarjeta:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.doc-icono {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(var(--tema-rgb), 0.1);
    color: var(--tema);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* Roles */
.rol-tarjeta {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rol-tarjeta:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Pasos "Cómo funciona" */
.paso-numero {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tema);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.25rem 0.75rem var(--tema-sombra);
}

/* Landing: comunicados */
.texto-comunicado {
    overflow: hidden;
    font-size: 0.95rem;
}

.texto-comunicado img {
    max-width: 100%;
    height: auto;
}

.texto-comunicado p:last-child {
    margin-bottom: 0;
}

/* ============================================
   NOTICIAS (BLOG)
   ============================================ */

/* Encabezado de sección con línea decorativa */
.seccion-titulo {
    position: relative;
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
}

.seccion-titulo::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    border-radius: 3px;
    background: var(--tema);
}

/* Breadcrumb personalizado */
.breadcrumb-lib .breadcrumb {
    --bs-breadcrumb-divider-color: rgba(255, 255, 255, 0.6);
}

.breadcrumb-lib .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.breadcrumb-lib .breadcrumb-item a:hover {
    color: #fff;
    text-decoration: underline;
}

.breadcrumb-lib .breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.6);
}

/* Título de página de noticias */
.noticias-titulo {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
}

/* Contador de resultados */
.contador-resultados {
    font-size: 0.85rem;
    padding: 0.4em 1em;
    border-radius: 50rem;
}

/* Cards de blog */
.blog-card {
    overflow: hidden;
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15) !important;
}

.blog-card-img {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.blog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-img img {
    transform: scale(1.06);
}

.blog-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.35));
    pointer-events: none;
}

/* Badge de categoría sobre la imagen */
.blog-badge-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.75em;
    border-radius: 50rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Fecha estilo calendario */
.blog-fecha {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 58px;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    line-height: 1;
}

.blog-fecha-dia {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tema);
}

.blog-fecha-mes {
    font-size: 0.65rem;
    font-weight: 700;
    color: #6c757d;
    letter-spacing: 0.08em;
}

/* Cuerpo de la card */
.blog-card-body {
    padding: 1.25rem;
}

.blog-titulo {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.blog-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

.blog-meta i {
    color: var(--tema);
    margin-right: 0.25rem;
}

/* Resumen con degradado de truncado */
.blog-resumen {
    position: relative;
}

.blog-resumen .texto-comunicado {
    max-height: 84px;
    line-height: 1.5;
}

.blog-resumen::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
    pointer-events: none;
}

/* Chips de documentos adjuntos */
.blog-doc {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    background: var(--tema-claro);
    color: var(--tema);
    border: 1px solid var(--tema-border);
    border-radius: 50rem;
    padding: 0.3em 0.8em;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.blog-doc:hover {
    background: var(--tema);
    color: #fff;
    border-color: var(--tema);
}

/* Botón leer más */
.blog-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tema);
    text-decoration: none;
    transition: gap 0.2s ease, color 0.2s ease;
}

.blog-btn i {
    transition: transform 0.2s ease;
}

.blog-btn:hover {
    color: var(--tema-hover);
}

.blog-btn:hover i {
    transform: translateX(4px);
}

/* Paginación estilizada */
.pagination-lib .page-link {
    color: var(--tema);
    border-radius: 0.5rem;
    margin: 0 0.2rem;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.pagination-lib .page-link:hover {
    background: var(--tema-claro);
    color: var(--tema-hover);
}

.pagination-lib .page-item.active .page-link {
    background-color: var(--tema);
    border-color: var(--tema);
    box-shadow: 0 0.25rem 0.75rem var(--tema-sombra);
}

.pagination-lib .page-item.disabled .page-link {
    color: #adb5bd;
    background: #f8f9fa;
}

@media (max-width: 576px) {
    .pagination-lib .page-link {
        min-width: 34px;
        margin: 0 0.1rem;
    }
}

/* ============================================
   DETALLE DE PUBLICACIÓN (post.php)
   ============================================ */

/* Enlace del título en cards de blog */
.blog-titulo-link {
    color: #212529;
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-titulo-link:hover {
    color: var(--tema);
}

/* Título y lead del encabezado */
.post-titulo {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    line-height: 1.25;
}

.post-lead {
    font-size: 1rem;
    opacity: 0.9;
}

/* Contenedor principal */
.post-card {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
}

/* Imagen destacada */
.post-img {
    max-height: 420px;
    overflow: hidden;
}

.post-img img {
    object-fit: cover;
    max-height: 420px;
}

/* Cuerpo de la publicación */
.post-body {
    padding: 2rem;
}

/* Tipografía de lectura */
.post-contenido {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #343a40;
}

.post-contenido p {
    margin-bottom: 1.1rem;
}

.post-contenido h1,
.post-contenido h2,
.post-contenido h3,
.post-contenido h4,
.post-contenido h5 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.post-contenido img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.post-contenido a {
    color: var(--tema);
}

.post-contenido blockquote {
    border-left: 4px solid var(--tema);
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: #6c757d;
}

.post-contenido ul,
.post-contenido ol {
    padding-left: 1.5rem;
    margin-bottom: 1.1rem;
}

.post-contenido table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.post-contenido table th,
.post-contenido table td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
}

.post-contenido iframe {
    max-width: 100%;
}

/* Navegación anterior/siguiente */
.post-nav {
    border-top: 1px solid #f1f3f5;
    padding: 1.25rem 2rem;
    background: #fafbfc;
}

.post-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #212529;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-nav-link:hover {
    color: var(--tema);
}

.post-nav-next {
    justify-content: flex-end;
    text-align: right;
}

.post-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tema-claro);
    color: var(--tema);
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.post-nav-link:hover .post-nav-arrow {
    background: var(--tema);
    color: #fff;
}

.post-nav-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.post-nav-text small {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}

.post-nav-text strong {
    font-size: 0.9rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}

@media (max-width: 768px) {
    .post-body {
        padding: 1.25rem;
    }

    .post-contenido {
        font-size: 1rem;
        line-height: 1.7;
    }

    .post-nav {
        padding: 1rem 1.25rem;
    }

    .post-nav-text strong {
        max-width: 180px;
        white-space: normal;
    }
}

/* ============================================
   FOOTER CON TEMA
   ============================================ */
.footer-tema {
    background-color: var(--tema-oscuro) !important;
}

/* Navbar */
.navbar-brand i {
    margin-right: 5px;
}

/* Tablas DataTables */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.25rem;
}

/* Cards */
.card {
    border: none;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Badges de rol */
.badge {
    font-weight: 500;
}

/* Formularios */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Vista previa de imágenes */
.img-thumbnail {
    object-fit: cover;
}

/* Responsive */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .display-6 {
        font-size: 2rem;
    }

    .hero .display-4 {
        font-size: 2.5rem;
    }

    .hero-icon {
        font-size: 2.5rem;
    }
}