/**
 * Legal Reader Toolbar & Document Styling - Relatoria Minimal Theme
 */

.rel-legal-container {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    margin-bottom: 2rem;
    transition: background 0.3s ease, color 0.3s ease;
    position: relative;
}

/* Modo Lectura Nocturno / Alto Contraste */
.rel-legal-container.rel-dark-mode {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

.rel-legal-container.rel-dark-mode .entry-content,
.rel-legal-container.rel-dark-mode .entry-content p,
.rel-legal-container.rel-dark-mode .entry-content h1,
.rel-legal-container.rel-dark-mode .entry-content h2,
.rel-legal-container.rel-dark-mode .entry-content h3,
.rel-legal-container.rel-dark-mode .entry-content h4 {
    color: #f8fafc !important;
}

.rel-legal-container.rel-dark-mode a {
    color: #38bdf8 !important;
}

/* ==========================================
   STICKY LEGAL READER TOOLBAR
   ========================================== */
.rel-legal-toolbar {
    position: sticky;
    top: 80px;
    z-index: 100;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.admin-bar .rel-legal-toolbar {
    top: 112px;
}

/* Buscador de texto interno */
.rel-toolbar-search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    flex: 1 1 260px;
}

.rel-toolbar-search-input {
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #1e293b;
    padding: 0.35rem 0.5rem;
    width: 100%;
    outline: none;
}

.rel-search-count-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
    display: none;
}

.rel-search-nav-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rel-search-nav-btn:hover {
    background: #0F3A85;
    color: #ffffff;
    border-color: #0F3A85;
}

/* Resaltado de Texto */
mark.rel-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

mark.rel-highlight.rel-active-mark {
    background-color: #f59e0b;
    color: #ffffff;
    box-shadow: 0 0 0 2px #b45309;
}

/* Índice de Artículos (TOC) */
.rel-toolbar-toc-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rel-toc-select {
    height: 36px;
    padding: 0 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    max-width: 220px;
}

/* Herramientas de Tamaño de Texto & Utilidades */
.rel-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.rel-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    padding: 0 0.6rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.rel-tool-btn:hover {
    background: #0F3A85;
    color: #ffffff;
    border-color: #0F3A85;
}

/* Toast Notification Floating */
.rel-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #0f172a;
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.rel-toast.is-show {
    opacity: 1;
    transform: translateY(0);
}

/* Resaltado Automático de Notas del Usuario - 4 Colores */
mark.rel-user-highlight {
    padding: 1px 4px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* 1. Amarillo (Default) */
mark.rel-user-highlight,
mark.rel-user-highlight.rel-color-yellow {
    background-color: #fef08a !important;
    color: #854d0e !important;
    border-bottom: 2px solid #d97706 !important;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.15) !important;
}
mark.rel-user-highlight:hover,
mark.rel-user-highlight.rel-color-yellow:hover {
    background-color: #fde047 !important;
    color: #713f12 !important;
    border-bottom-color: #b45309 !important;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3) !important;
}

/* 2. Azul */
mark.rel-user-highlight.rel-color-blue {
    background-color: #bfdbfe !important;
    color: #1e3a8a !important;
    border-bottom: 2px solid #2563eb !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15) !important;
}
mark.rel-user-highlight.rel-color-blue:hover {
    background-color: #93c5fd !important;
    color: #172554 !important;
    border-bottom-color: #1d4ed8 !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3) !important;
}

/* 3. Rosa */
mark.rel-user-highlight.rel-color-pink {
    background-color: #fbcfe8 !important;
    color: #831843 !important;
    border-bottom: 2px solid #db2777 !important;
    box-shadow: 0 1px 3px rgba(219, 39, 119, 0.15) !important;
}
mark.rel-user-highlight.rel-color-pink:hover {
    background-color: #f9a8d4 !important;
    color: #500724 !important;
    border-bottom-color: #be185d !important;
    box-shadow: 0 2px 6px rgba(219, 39, 119, 0.3) !important;
}

/* 4. Verde */
mark.rel-user-highlight.rel-color-green {
    background-color: #bbf7d0 !important;
    color: #14532d !important;
    border-bottom: 2px solid #16a34a !important;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.15) !important;
}
mark.rel-user-highlight.rel-color-green:hover {
    background-color: #86efac !important;
    color: #052e16 !important;
    border-bottom-color: #15803d !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3) !important;
}

/* Selector de Color en el Modal */
.rel-color-option {
    user-select: none;
}
.rel-color-option:hover {
    border-color: #94a3b8 !important;
    background-color: #f1f5f9 !important;
}
.rel-color-option.is-selected {
    border-color: #0F3A85 !important;
    background-color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(15, 58, 133, 0.15) !important;
}

/* Modal de Notas Privadas por Selección de Texto */

.rel-note-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

.rel-note-modal-card {
    background: #ffffff;
    border-radius: 12px;
    max-width: 550px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #cbd5e1;
    animation: relModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes relModalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.rel-note-modal-header {
    padding: 1.1rem 1.5rem;
    background: #0F3A85;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rel-note-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.rel-note-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ==========================================
   ESTILOS DE DETALLES DEL DOCUMENTO (CPTs)
   ========================================== */

.rel-doc-details-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    margin: 2.5rem 0 1.5rem 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rel-doc-details-header {
    background: linear-gradient(135deg, #0F3A85 0%, #1E40AF 100%);
    color: #ffffff;
    padding: 0.9rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.2px;
}

.rel-doc-details-table,
.entry-content table.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 !important;
    font-size: 0.925rem;
}

.rel-doc-details-table tr,
.entry-content table.table tr {
    border-bottom: 1px solid #e2e8f0;
}

.rel-doc-details-table tr:nth-child(even),
.entry-content table.table tr:nth-child(even) {
    background-color: #f8fafc;
}

.rel-doc-details-table tr:nth-child(odd),
.entry-content table.table tr:nth-child(odd) {
    background-color: #ffffff;
}

.rel-doc-details-table td,
.entry-content table.table td {
    padding: 0.75rem 1.25rem;
    vertical-align: top;
    line-height: 1.6;
}

.rel-doc-details-table td:first-child,
.entry-content table.table td:first-child {
    font-weight: 600;
    color: #334155;
    width: 35%;
    background-color: #f1f5f9;
    border-right: 1px solid #e2e8f0;
}

.rel-doc-details-table td:last-child,
.entry-content table.table td:last-child {
    color: #0f172a;
    font-weight: 500;
}

/* Botón Institucional de Descargar Archivo */
.rel-doc-download-btn,
.entry-content a.button {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    background-color: #0F3A85 !important;
    color: #ffffff !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.925rem !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(15, 58, 133, 0.25) !important;
    transition: all 0.25s ease !important;
    border: none !important;
}

.rel-doc-download-btn:hover,
.entry-content a.button:hover {
    background-color: #1e40af !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(15, 58, 133, 0.35) !important;
    color: #ffffff !important;
}

/* Modo Lectura Nocturno para Detalles del Documento */
.rel-legal-container.rel-dark-mode .rel-doc-details-card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

.rel-legal-container.rel-dark-mode .rel-doc-details-table tr:nth-child(even),
.rel-legal-container.rel-dark-mode .entry-content table.table tr:nth-child(even) {
    background-color: #1e293b !important;
}

.rel-legal-container.rel-dark-mode .rel-doc-details-table tr:nth-child(odd),
.rel-legal-container.rel-dark-mode .entry-content table.table tr:nth-child(odd) {
    background-color: #0f172a !important;
}

.rel-legal-container.rel-dark-mode .rel-doc-details-table td:first-child,
.rel-legal-container.rel-dark-mode .entry-content table.table td:first-child {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

.rel-legal-container.rel-dark-mode .rel-doc-details-table td:last-child,
.rel-legal-container.rel-dark-mode .entry-content table.table td:last-child {
    color: #f8fafc !important;
}

/* Impresión Limpia (@media print) */
@media print {
    .rel-top-header,
    .rel-main-header,
    .rel-legal-toolbar,
    .rel-footer,
    .rel-mobile-drawer,
    .rel-header-action {
        display: none !important;
    }

    body, .rel-legal-container {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ==========================================
   ESTILOS NATIVOS DE NORMAS, REFERENCIAS Y NUMERALES
   ========================================== */
.referencia-norma {
    font-weight: 700;
}

.titulo-norma {
    text-align: center !important;
    font-weight: 700;
    font-size: 18px;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    color: #002855;
}

/* Texto Justificado para párrafos e incisos (excepto títulos centrados) */
.rel-legal-content p,
.rel-legal-content li,
.entry-content p,
.entry-content li {
    text-align: justify;
    text-justify: inter-word;
}

.titulo-norma,
.rel-page-title,
.rel-legal-content .has-text-align-center,
.entry-content .has-text-align-center {
    text-align: center !important;
}

/* Numerales y Listas Ordenadas/Desordenadas dentro del Margen */
.rel-legal-content ol,
.rel-legal-content ul,
.entry-content ol,
.entry-content ul {
    padding-left: 2rem !important;
    margin-left: 0 !important;
    margin-bottom: 1.25rem;
}

.rel-legal-content ol li,
.rel-legal-content ul li,
.entry-content ol li,
.entry-content ul li {
    margin-bottom: 0.5rem;
    padding-left: 0.35rem;
}

/* Títulos de Normativas (Centrados y Negrilla) */
.titulo-norma,
.rel-legal-content p.titulo-norma,
.entry-content p.titulo-norma {
    text-align: center !important;
    font-weight: 700 !important;
    font-size: 1.2rem !important;
    margin-top: 2.25rem !important;
    margin-bottom: 1.25rem !important;
    color: #002855;
    display: block !important;
}

/* Referencias y números de artículos */
.referencia-norma {
    font-weight: 700 !important;
    color: #002855;
    display: inline-block;
}

/* Espaciado / Salto de línea doble antes de cada artículo */
.articulo-paragraph,
p.articulo-paragraph,
.rel-legal-content p.articulo-paragraph,
.entry-content p.articulo-paragraph,
.rel-legal-content p:has(.referencia-norma),
.entry-content p:has(.referencia-norma) {
    margin-top: 2.5rem !important;
    margin-bottom: 1.15rem !important;
    display: block !important;
}

/* Formateo de Numerales (1., 1o., 2o., 3°., 4.) */
.numeral-item,
p.numeral-item,
.rel-legal-content p.numeral-item,
.entry-content p.numeral-item {
    margin-left: 1.5rem !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
    margin-top: 0.6rem !important;
    margin-bottom: 0.6rem !important;
}

.numeral-label {
    font-weight: 700 !important;
    color: #002855;
    margin-right: 0.4rem !important;
    display: inline !important;
    min-width: 0 !important;
}


.rel-legal-content p,
.entry-content p {
    margin-bottom: 1.15rem !important;
    line-height: 1.7 !important;
}

.rel-legal-container.rel-dark-mode .referencia-norma,
.rel-legal-container.rel-dark-mode .numeral-label {
    color: #38bdf8;
}

.rel-legal-container.rel-dark-mode .titulo-norma {
    color: #93c5fd;
}

/* Shortcode de Encabezado de Página [rel_page_header] / [rel_titulo] */
.rel-page-header-card {
    padding: 2.25rem 2rem;
    margin-bottom: 2rem;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.rel-page-header-card.rel-header-align-center {
    text-align: center !important;
}

.rel-page-header-card.rel-header-align-left {
    text-align: left !important;
}

.rel-page-header-card.rel-header-align-right {
    text-align: right !important;
}

.rel-header-badge-wrapper {
    margin-bottom: 0.85rem;
}

.rel-header-badge {
    background: rgba(15, 58, 133, 0.08);
    color: #0F3A85;
    font-size: 0.775rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: inline-flex;
    align-items: center;
}

.rel-header-icon {
    font-size: 1.75rem;
    color: #0F3A85;
    margin-bottom: 0.75rem;
}

.rel-page-header-title {
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    color: #002855 !important;
    margin: 0 0 0.5rem 0 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.4px;
    border: none !important;
}

.rel-page-header-subtitle {
    font-size: 1rem !important;
    color: #475569 !important;
    margin: 0 !important;
    font-weight: 500 !important;
    line-height: 1.6 !important;
    max-width: 820px;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Estilo 1: card */
.rel-page-header-card.rel-header-style-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    border-top: 4px solid #0F3A85;
    box-shadow: 0 10px 30px rgba(15, 58, 133, 0.05);
}

/* Estilo 2: banner */
.rel-page-header-card.rel-header-style-banner {
    background: linear-gradient(135deg, #002855 0%, #0F3A85 60%, #1E40AF 100%);
    border-radius: 16px;
    padding: 2.75rem 2.25rem;
    color: #ffffff;
    box-shadow: 0 15px 35px rgba(15, 58, 133, 0.22);
    overflow: hidden;
}

.rel-page-header-card.rel-header-style-banner .rel-page-header-title {
    color: #ffffff !important;
}

.rel-page-header-card.rel-header-style-banner .rel-page-header-subtitle {
    color: #cbd5e1 !important;
}

.rel-page-header-card.rel-header-style-banner .rel-header-badge {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* Estilo 3: hero */
.rel-page-header-card.rel-header-style-hero {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    padding: 3rem 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
}

.rel-page-header-card.rel-header-style-hero .rel-page-header-title {
    font-size: 2.1rem !important;
}

.rel-page-header-card.rel-header-style-clean {
    background: transparent;
    padding: 1rem 0;
    border: none;
    box-shadow: none;
}







