/* ===== MODERNIZACIÓN DE ORDENANZAS - CSS ACTUALIZADO ===== */

/* Variables CSS basadas en style1.css */
:root {
    --primary-color: #4A90E2 !important; /* Azul del círculo del logo */
    --primary-hover: #5BA0F2 !important; /* Azul más claro para hover */
    --primary-active: #3A80D2 !important; /* Azul más oscuro para active */
    --secondary-color: #FF6B35 !important; /* Naranja/rojo del gradiente superior */
    --secondary-hover: #FF8A65 !important; /* Naranja más claro para hover */
    --accent-color: #7ED321; /* Verde del gradiente inferior */

    --accent-green: #7ED321;
    --text-color: #555555;
    --background-color: #f9f9f9;
    --border-color: #ccc;
    --texto-menu: black;
    --texto-hover: white;
}

/* Reset y configuración base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--background-color) 0%, #e8eef2 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

/* Contenedor principal */
body > div[align="center"] {
    max-width: 1000px;
    margin: 0 auto;
    background: transparent;
}

/* Logo header */
body > p[align="center"]:first-child,
body > div > p[align="center"]:first-child {
    background: white;
    padding: 30px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 0;
    position: relative;
}

body > p[align="center"]:first-child::after,
body > div > p[align="center"]:first-child::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* Logo */
img[src="logo.jpg"] {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

img[src="logo.jpg"]:hover {
    transform: scale(1.02);
}

/* Contenedor principal del documento */
div[id="uno"],
div[style*="background-color: #D8D8D8"] {
    background: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    padding: 40px !important;
    margin: 0 !important;
    overflow: visible !important;
    height: auto !important;
}

/* Título principal - Comisión Comunal */
p[align="center"] b a[name],
p[align="center"] b {
    display: block;
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-decoration: none;
    font-weight: 600;
}

p[align="left"] b:first-child {
    background: var(--accent-color);
    color: white !important;
    padding: 8px 20px;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
    letter-spacing: 0.5px;
}

/* Título del documento (centro) */
p[align="center"] b:not(:first-child) {
    font-size: 1.8rem;
    color: var(--primary-color);
    display: block;
    margin: 20px 0 30px 0;
    text-align: center;
    line-height: 1.3;
    font-weight: 700;
}

/* Párrafos de justificación */
p[align="justify"] {
    margin-bottom: 15px;
    text-align: justify;
    color: var(--text-color);
    line-height: 1.7;
    text-indent: 0;
}

/* Artículos - aplicados por JavaScript */
.article-title {
    background: var(--accent-color);
    color: white !important;
    padding: 12px 18px;
    border-radius: 6px;
    display: block;
    margin: 25px 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
    position: relative;
}

.article-title::before {
    content: '* ';
    margin-right: 8px;
    font-weight: bold;
}

/* Contenido de artículos - aplicados por JavaScript */
.article-content {
    background: var(--background-color);
    padding: 18px;
    border-left: 4px solid var(--accent-color);
    border-radius: 0 6px 6px 0;
    margin: 0 0 20px 0;
    transition: all 0.3s ease;
}

/* Blockquotes (espaciadores) */
blockquote {
    display: none; /* Ocultar espaciadores innecesarios */
}

/* Tabla de firmas */
table[border="0"] {
    width: 100%;
    background: var(--background-color);
    border-radius: 6px;
    overflow: hidden;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

table[border="0"] td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

table[border="0"] tr:last-child td {
    border-bottom: none;
}

table[border="0"] p {
    margin: 0;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Fecha final */
p[align="right"] b:contains("SAN JERONIMO") {
    background: var(--background-color);
    padding: 12px 20px;
    border-radius: 6px;
    display: inline-block;
    color: var(--text-color) !important;
    font-weight: 600;
    margin: 20px 0;
    border-left: 3px solid var(--accent-green);
}

/* Separador HR */
hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    margin: 40px 0;
    border-radius: 1px;
}

/* CORREGIDO: Link "Volver al Inicio" - Evitar caracteres especiales problemáticos */
.back-button-modern,
p.nover a,
p[align="center"] a:contains("Volver") {
    background: var(--primary-color);
    color: white !important;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 26, 26, 0.2);
    font-size: 14px;
}

.back-button-modern:hover,
p.nover a:hover,
p[align="center"] a:contains("Volver"):hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.3);
}

/* NUEVO: Iconos para flecha - usando entidades HTML correctas */
.arrow-icon {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    pointer-events: none;
}

.arrow-up {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    pointer-events: none;
}

.search-icon {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    pointer-events: none;
}

.clear-icon {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    pointer-events: none;
}

/* Enlaces en el listado de ordenanzas */
p[align="left"] a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
}

p[align="left"] a:hover {
    color: var(--secondary-color);
    background: rgba(255, 107, 53, 0.1);
    text-decoration: underline;
}

/* Contenedor de lista de ordenanzas */
div[id="cajaDerVerde"] {
    background: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    padding: 20px !important;
}

/* NUEVOS: Estilos para la búsqueda avanzada - aplicados por JavaScript */
.advanced-search-container {
    font-family: inherit;
}

.search-highlight {
    background: #ffeb3b !important;
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(255, 235, 59, 0.5);
    transition: all 0.3s ease;
}

.search-highlight.current {
    background: #ff9800 !important;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.5);
    transform: scale(1.02);
}

/* Botón de scroll to top mejorado */
.scroll-to-top {
    background: var(--primary-color) !important;
    box-shadow: 0 2px 10px rgba(26, 26, 26, 0.2) !important;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scroll-to-top:hover {
    background: var(--primary-hover) !important;
    box-shadow: 0 4px 15px rgba(26, 26, 26, 0.3) !important;
    transform: scale(1.1);
}

/* Barra de progreso */
.reading-progress {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Estilos responsivos mejorados */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    div[id="uno"],
    div[style*="background-color: #D8D8D8"],
    div[id="cajaDerVerde"] {
        padding: 20px !important;
        border-radius: 6px !important;
    }
    
    body > p[align="center"]:first-child,
    body > div > p[align="center"]:first-child {
        padding: 20px;
        border-radius: 6px 6px 0 0;
    }
    
    p[align="center"] b:not(:first-child) {
        font-size: 1.4rem;
        line-height: 1.2;
    }
    
    img[src="logo.jpg"] {
        max-width: 200px;
    }
    
    /* Búsqueda responsive */
    .advanced-search-container {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        max-width: none !important;
        min-width: auto !important;
    }
    
    .search-toggle {
        top: 10px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }
    
    .scroll-to-top {
        bottom: 20px !important;
        right: 20px !important;
        width: 45px !important;
        height: 45px !important;
    }
}

/* Estilos para impresión */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    div[id="uno"],
    div[style*="background-color: #D8D8D8"],
    div[id="cajaDerVerde"] {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .nover,
    .advanced-search-container,
    .search-toggle,
    .scroll-to-top,
    .reading-progress {
        display: none !important;
    }
    
    .search-highlight {
        background: #f0f0f0 !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .search-highlight.current {
        background: #e0e0e0 !important;
        color: black !important;
        font-weight: bold;
    }
}

/* Animaciones sutiles mejoradas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

div[id="uno"],
div[style*="background-color: #D8D8D8"],
div[id="cajaDerVerde"] {
    animation: fadeInUp 0.6s ease-out;
}

/* Mejoras adicionales para elementos específicos */
p[align="justify"]:hover {
    background: rgba(74, 144, 226, 0.03);
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Limpiar pseudo-elementos problemáticos */
p[align="justify"]::before,
p[align="justify"]::after {
    content: none !important;
    display: none !important;
}

.article-container {
    margin: 25px 0;
    transition: all 0.3s ease;
}

.article-content {
    background: var(--background-color);
    padding: 18px;
    border-left: 4px solid var(--accent-color);
    border-radius: 0 6px 6px 0;
    margin: 0 0 20px 0;
}

/* Estilos para tooltips y elementos interactivos */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 5px;
    pointer-events: none;
}

/* Mejoras para accesibilidad */
.skip-links a:focus {
    position: relative;
    top: 0;
    left: 0;
}

/* Focus styles para elementos interactivos */
.back-button-modern:focus,
.search-toggle:focus,
.scroll-to-top:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Estados de hover para elementos táctiles */
@media (hover: hover) {
    .article-container:hover {
        transform: translateX(3px);
        box-shadow: 0 2px 12px rgba(74, 144, 226, 0.15);
    }
}

/* Mejoras para el contraste y legibilidad */
.signatures-table td {
    border-bottom: 1px solid var(--border-color);
}

.signatures-table tr:hover {
    background: rgba(74, 144, 226, 0.05);
}

/* Estilos para elementos de fecha */
p[align="right"] b {
    background: var(--background-color);
    padding: 12px 20px;
    border-radius: 6px;
    display: inline-block;
    color: var(--text-color) !important;
    font-weight: 600;
    margin: 20px 0;
    border-left: 3px solid var(--accent-green);
}