* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Oswald', sans-serif; 
}

body {
    font-family: 'Oswald', sans-serif; 
    background: #ffffff;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* --- NUEVO: Estilos Buscador RAG --- */
.search-section {
    margin-bottom: 25px;
    background: linear-gradient(135deg, #043249 0%, #064e6b 100%); /* Azul corporativo con gradiente */
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    text-align: center;
    color: white;
}

.rag-container {
    max-width: 800px;
    margin: 0 auto;
}

.rag-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 1px;
    opacity: 0.9;
}

.rag-header i { color: #4fc3f7; } /* Azul claro cyan para destacar el cerebro */

.rag-input-group {
    display: flex;
    gap: 0; /* Sin gap, el botón pega con el input */
    background: white;
    padding: 4px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s;
}

.rag-input-group:focus-within {
    transform: scale(1.01);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

#rag-search-input {
    flex-grow: 1;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 50px 0 0 50px;
    outline: none;
    background: transparent;
    color: #333;
}

#btn-rag-search {
    background: linear-gradient(90deg, #ab182b 0%, #c41c35 100%); /* Rojo corporativo */
    color: white;
    border: none;
    padding: 0 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

#btn-rag-search:hover {
    background: linear-gradient(90deg, #8f141e 0%, #a6172a 100%);
}

.rag-hint {
    margin-top: 12px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    font-weight: 300;
}

/* --- NUEVO: Estilos Filtros Modernos --- */
.filters-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.filters-header {
    margin-bottom: 15px;
    color: #043249;
    font-weight: 600;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.filters-header i {
    color: #ab182b; /* Icono rojo */
}

/* Rejilla de filtros (reemplaza .controls-grid anterior) */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper .icon-select {
    position: absolute;
    left: 14px;
    color: #043249;
    pointer-events: none;
    font-size: 0.9em;
    opacity: 0.7;
}

.select-wrapper select {
    width: 100%;
    padding: 10px 15px 10px 40px; /* Padding izquierdo para el icono */
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #2d3748;
    appearance: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.select-wrapper select:focus {
    border-color: #043249;
    background-color: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(4, 50, 73, 0.1);
}

/* Flecha custom para selects */
.select-wrapper::after {
    content: '\f078'; /* FontAwesome chevron down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    font-size: 0.7rem;
    color: #718096;
    pointer-events: none;
}

.filters-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    margin-top: 5px;
}

.btn-clear {
    background-color: transparent;
    border: 1px solid #cbd5e0;
    color: #718096;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-clear:hover {
    background-color: #fee2e2;
    color: #e53e3e;
    border-color: #e53e3e;
}

.results-count {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

/* --- FIN NUEVOS ESTILOS --- */


/* --- HEADER Y NAVEGACIÓN (Original) --- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    background: #dbdbda;
    padding: 15px 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 1);
    margin-bottom: 0;
    width: 100%;
}

.telegram-link { margin-left: auto; }

.telegram-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #0088cc;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.telegram-link a:hover {
    background: #006699;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
}

.logo { height: 60px; flex-shrink: 0; }
.logo img { height: 100%; object-fit: contain; }

.header { flex: 1; color: white; padding: 10px 20px; }
.header h1 {
    font-size: 2em;
    margin-bottom: 5px;
    color: #2c3e50;
    text-shadow: none;
    font-weight: 400;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header p {
    font-family: 'Oswald', sans-serif;
    font-size: 1em;
    color: #666666;
    font-weight: 400;
    line-height: 1.4;
}

.nav-links { display: flex; gap: 15px; margin-right: 20px; }
.nav-btn {
    text-decoration: none;
    color: #043249;
    font-weight: 500;
    font-size: 1em;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.nav-btn:hover {
    background-color: rgba(4, 50, 73, 0.1);
    color: #ab182b;
}

@media (max-width: 900px) { .nav-links { display: none; } }
@media (max-width: 768px) {
    .header-subtitle { display: none !important; }
    .header h1 { font-size: 1.8em !important; }
    .top-bar { padding: 12px 16px !important; }
}


/* --- TABLA Y CONTENIDO (Original) --- */
.loading {
    text-align: center;
    color: #043249; /* Cambiado a oscuro para verse en fondo blanco */
    font-size: 1.1em;
    display: none;
    padding: 20px;
}

.error {
    background: #d32f2f;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    border-left: 5px solid #b71c1c;
}

.table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1); /* Sombra suavizada */
    overflow-x: auto; 
}

table { width: 100%; border-collapse: collapse; }
thead { background: #043249; color: white; }

th {
    padding: 16px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    line-height: 1.1;
}

th:hover { background: rgba(255,255,255,0.1); }
.sort-indicator { margin-left: 6px; font-size: 0.75em; }
th i { font-size: 0.9em; }

td {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95em;
}

tbody tr { transition: background-color 0.2s ease; cursor: pointer; }
tbody tr:hover { background-color: #f0f7f3; }
tbody tr:last-child td { border-bottom: none; }

.tag {
    display: inline-block;
    background: #043249;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag:hover { background: #065a75; transform: scale(1.05); }

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #9d9b9a;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.1;
}
.type-badge i { font-size: 0.7em; flex-shrink: 0; }

.url-cell {
    color: #043249;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    line-height: 1.2;
}
.url-cell i { font-size: 0.9em; flex-shrink: 0; }
.url-cell:hover { text-decoration: underline; color: #043249; }

.timestamp { color: #999; font-size: 0.85em; }
.empty { text-align: center; padding: 40px; color: #999; font-size: 1.1em; }
.acciones-cell { text-align: center; width: 80px; }

.btn-ver-detalle {
    background: #ab182b;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-ver-detalle:hover {
    background: #8f141e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(4, 50, 73, 0.3);
}

/* --- MODAL (Original) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
@keyframes slideDown { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #043249;
    padding-bottom: 15px;
}

.modal-header h2 {
    color: #043249;
    font-size: 1.8em;
    margin: 0;
    word-break: break-word;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #043249;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 20px;
}
.close-btn:hover { transform: rotate(90deg); }

.modal-section { margin-bottom: 20px; }
.modal-section-title {
    color: #043249;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-content {
    color: #333;
    line-height: 1.6;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #2d5f47;
    word-break: break-word;
}

.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.modal-tag {
    background: #043249;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal-tag:hover { background: #065a75; transform: scale(1.05); }

.modal-link {
    color: #043249;
    word-break: break-all;
    text-decoration: none;
    font-weight: 500;
}
.modal-link:hover { text-decoration: underline; }

#modal-resumen { white-space: pre-line; }
.icon { font-size: 1.2em; flex-shrink: 0; }



/* UNDER CONSTRUCTION (quitar)*/
/* --- ESTILOS UNDER CONSTRUCTION --- */
.search-section.under-construction {
    position: relative;
    overflow: hidden;
}

/* Difuminar y desactivar el contenido original */
.search-section.under-construction .rag-container {
    opacity: 0.3;
    filter: grayscale(100%);
    pointer-events: none; /* Evita cualquier click en el fondo */
    user-select: none;
}

/* El cartel superpuesto */
.construction-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    
    background: rgba(4, 50, 73, 0.95); /* Azul muy oscuro casi opaco */
    color: #f6ad55; /* Naranja tipo "obra" */
    border: 2px solid #f6ad55;
    
    padding: 15px 30px;
    border-radius: 50px;
    
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1rem;
    
    display: flex;
    align-items: center;
    gap: 15px;
    
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.construction-overlay i {
    font-size: 1.4rem;
    animation: wrench 2.5s infinite ease-in-out;
}

/* Pequeña animación para el icono de herramientas */
@keyframes wrench {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(-20deg); }
    20% { transform: rotate(10deg); }
    30% { transform: rotate(-20deg); }
    40% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}
