/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Encabezado */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #4CAF50 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.logo-container {
    margin-bottom: 15px;
}

.logo {
    width: 150px;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

#titulo-principal {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 16px;
    opacity: 0.95;
    font-weight: 300;
}

/* Contenedor principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

/* Sección de búsqueda */
.search-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

/* Toggle de idioma */
.language-toggle {
    display: flex;
    margin-bottom: 20px;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background-color: #e2e8f0;
    color: #4a5568;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.toggle-btn:hover {
    background-color: #cbd5e0;
}

.toggle-btn.active {
    background-color: #4CAF50;
    color: white;
    font-weight: 600;
}

.toggle-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.toggle-btn:last-child {
    border-radius: 0 8px 8px 0;
}

/* Caja de búsqueda */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#search-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#search-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#search-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

#search-btn:active {
    transform: translateY(0);
}

/* Filtros */
.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    background-color: white;
}

.filter-group select:focus {
    outline: none;
    border-color: #4CAF50;
}

.clear-btn {
    background-color: #f56565;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    align-self: flex-end;
}

.clear-btn:hover {
    background-color: #e53e3e;
    transform: translateY(-1px);
}

/* Información de resultados */
.results-info {
    margin-bottom: 20px;
    text-align: center;
}

#results-count {
    font-size: 16px;
    color: #4a5568;
    font-weight: 500;
}

/* Contenedor de resultados */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #718096;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.no-results h3 {
    color: #e53e3e;
    margin-bottom: 10px;
    font-size: 22px;
}

.no-results p {
    color: #718096;
    font-size: 16px;
}

/* Tarjetas de documentos */
.document-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border-left: 4px solid #4CAF50;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.doc-title {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
    line-height: 1.3;
}

.doc-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.doc-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

.badge-year {
    background-color: #ebf8ff;
    color: #2c5282;
}

.badge-type {
    background-color: #f0fff4;
    color: #22543d;
}

.doc-author {
    font-size: 15px;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 500;
}

.doc-description {
    font-size: 14px;
    color: #718096;
    margin-bottom: 12px;
    line-height: 1.5;
    flex-grow: 1;
}

.doc-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.keyword {
    padding: 3px 10px;
    background-color: #edf2f7;
    color: #4a5568;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.doc-actions {
    display: flex;
    gap: 10px;
}

.btn-view {
    flex: 1;
    padding: 10px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-view:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 10px 16px;
    background-color: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background-color: #f7fafc;
    border-color: #4CAF50;
}

.page-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Instrucciones */
.instructions {
    background-color: #ebf8ff;
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
    border-left: 4px solid #667eea;
}

.instructions h3 {
    color: #2c5282;
    margin-bottom: 15px;
    font-size: 20px;
}

.instructions p {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 15px;
}

.instructions a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.instructions a:hover {
    text-decoration: underline;
}

/* Pie de página */
.main-footer {
    background-color: #2d3748;
    color: white;
    padding: 30px 20px;
    text-align: center;
    margin-top: 40px;
}

.main-footer p {
    margin-bottom: 8px;
    font-size: 14px;
}

.main-footer a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
}

.main-footer a:hover {
    text-decoration: underline;
}

/* Responsivo */
@media (max-width: 768px) {
    #titulo-principal {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    #search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .filters-container {
        grid-template-columns: 1fr;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .clear-btn {
        align-self: stretch;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    .search-section {
        padding: 20px 15px;
    }
    
    .document-card {
        padding: 16px;
    }
    
    .language-toggle {
        flex-direction: column;
        border-radius: 8px;
    }
    
    .toggle-btn:first-child {
        border-radius: 8px 8px 0 0;
    }
    
    .toggle-btn:last-child {
        border-radius: 0 0 8px 8px;
    }
}