/* ================================
   ESTILOS CUERPO DE PAGINA
   ================================ */

body {
    background:
        linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)),
        url('../imagenes/fondoBuscadoroficial.webp') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
}

/* ================================
   CONTENEDOR DE BÚSQUEDA
   ================================ */
.search-container {
    padding: 40px 0;
    margin-top: 120px;
    position: relative;
    z-index: 1;
    background: transparent;
}

.contenedorPag {
    background: #fff;
    padding: 20px;
    border-radius: 25px;
    border: solid 2px #000;
}


/* ================================
   FORMULARIO DE BÚSQUEDA
   ================================ */
.search-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    min-height: fit-content;
}

/* ================================
   INPUTS Y PLACEHOLDERS
   ================================ */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #7a322e;
    box-shadow: 0 0 0 0.2rem rgba(122, 50, 46, 0.25);
}

.form-control::placeholder {
    color: #999;
    font-style: italic;
}

/* ================================
   BOTÓN FILTROS AVANZADOS
   ================================ */
.btn-toggle {
    background: #7a322e;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle:hover {
    background: #5a241f;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(122, 50, 46, 0.3);
}

/* ================================
   FILTROS AVANZADOS
   ================================ */
.advanced-search {
    display: none;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease;
}

.advanced-search.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: expandSection 0.4s ease forwards;
}

@keyframes expandSection {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
}

/* ================================
   FILTROS INDIVIDUALES
   ================================ */
.filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.filter-section h6 {
    color: #7a322e;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 16px;
}

/* ================================
   BOTONES DE PERÍODO
   ================================ */
.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.period-btn {
    background: white;
    border: 2px solid #7a322e;
    color: #7a322e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.period-btn:hover,
.period-btn.active {
    background: #7a322e;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(122, 50, 46, 0.2);
}

/* ================================
   CONTADOR DE RESULTADOS
   ================================ */
.results-count {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #7a322e;
}

/* ================================
   CARDS DE RESULTADOS
   ================================ */
.collection-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    transition: all 0.3s ease;
    border: 2px solid #000;
    animation: fadeInUp 0.6s ease forwards;
}

.collection-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.collection-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.collection-item:hover .collection-image {
    transform: scale(1.05);
}

.collection-content {
    padding: 25px;
}

.collection-title {
    font-size: 18px;
    font-weight: 600;
    color: #7a322e;
    margin-bottom: 12px;
    line-height: 1.3;
}

.collection-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.collection-meta i {
    color: #7a322e;
    width: 16px;
}

.collection-description {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* ================================
   BADGES
   ================================ */
.status-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    color: #000 !important;
    display: inline-block;
    margin: 5px 5px 5px 0;
}

.status-muy-bueno,
.status-muybueno {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    border: solid 1px #000 !important;
}

.status-bueno {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    border: solid 1px #000 !important;
}

.status-regular {
    background: linear-gradient(135deg, #f1c40f, #f39c12) !important;
    border: solid 1px #000 !important;
}

.status-malo {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
    border: solid 1px #000 !important;
}

.status-muy-malo,
.status-muymalo {
    background: linear-gradient(135deg, #c0392b, #8e0e00) !important;
    border: solid 1px #000 !important;
}

.material-badge {
    background: linear-gradient(135deg, #6f42c1, #495057) !important;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    margin: 2px;
    display: inline-block;
}

.technique-badge {
    background: #e9ecef;
    color: #495057;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    margin: 2px;
    display: inline-block;
    border: 1px solid #dee2e6;
}

/* ================================
   ESTADOS ESPECIALES
   ================================ */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: #666;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.no-results i {
    color: #7a322e;
    margin-bottom: 20px;
}

.no-results h4 {
    color: #7a322e;
    margin-bottom: 15px;
    font-weight: 600;
}

.no-results p {
    font-size: 14px;
    color: #555;
}

/* ================================
   ESTADO DE CARGA
   ================================ */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #7a322e;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.loading i {
    font-size: 2.5rem;
    color: #7a322e;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading p {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* ================================
   MENSAJE DE ERROR
   ================================ */
.error-message {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* ================================
   ANIMACIÓN DE APARICIÓN
   ================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   EFECTO CASCADA EN RESULTADOS
   ================================ */
.collection-item:nth-child(1) {
    animation-delay: 0.1s;
}

.collection-item:nth-child(2) {
    animation-delay: 0.2s;
}

.collection-item:nth-child(3) {
    animation-delay: 0.3s;
}

.collection-item:nth-child(4) {
    animation-delay: 0.4s;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

/* TABLETS Y PANTALLAS MEDIANAS (max-width: 992px) */
@media (max-width: 992px) {
    .search-container {
        margin-top: 100px;
        padding: 30px 0;
    }

    .contenedorPag {
        padding: 15px;
        border-radius: 20px;
    }

    .search-form {
        padding: 20px;
    }

    .period-buttons {
        justify-content: center;
    }

    .btn-group-custom {
        justify-content: center;
        width: 100%;
    }

    .collection-image {
        height: 200px;
    }

    /* Header responsive */
    .header-top {
        padding: 5px 0;
    }

    .top-head-left ul li,
    .top-head-right ul li {
        font-size: 12px;
    }
}

/* TABLETS PEQUEÑAS (max-width: 768px) */
@media (max-width: 768px) {
    body {
        margin-top: 120px !important;
    }

    .search-container {
        margin-top: 80px;
        padding: 20px 0;
    }

    .contenedorPag {
        padding: 15px;
        margin: 0 10px;
        border-radius: 15px;
    }

    .contenedorPag h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .search-form {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    /* Filtros en columna en móvil */
    .search-form .row {
        flex-direction: column;
    }

    .search-form .col-md-6 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: 15px;
    }

    .btn-group-custom {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .btn-toggle {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Filtros avanzados responsive */
    .advanced-search .row {
        flex-direction: column;
    }

    .advanced-search .col-md-4 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .filter-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .filter-section h6 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .form-control {
        font-size: 16px;
        /* Evita zoom en iOS */
        padding: 12px 15px;
    }

    /* Cards de colección responsive */
    .collection-content {
        padding: 15px;
    }

    .collection-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .collection-meta {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .collection-description {
        font-size: 13px;
    }

    .collection-image {
        height: 180px;
    }

    /* Botones de acción en cards */
    .collection-item div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .collection-item .btn-toggle {
        width: 100%;
        padding: 10px 15px;
        font-size: 13px;
    }

    .period-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Contador de resultados */
    .results-count {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Estados especiales */
    .no-results,
    .loading {
        padding: 40px 20px;
    }

    .no-results h2 {
        font-size: 1.2rem;
    }

    .no-results p {
        font-size: 13px;
    }

    /* Header en móvil */


    #header hr {
        display: none;
    }

    #logo img {
        max-height: 50px;
    }
}

/* MÓVILES PEQUEÑOS (max-width: 576px) */
@media (max-width: 576px) {
    body {
        margin-top: 100px !important;
    }

    .search-container {
        margin-top: 60px;
        padding: 15px 0;
    }

    .contenedorPag {
        padding: 12px;
        margin: 0 5px;
        border-radius: 12px;
    }

    .contenedorPag h1 {
        font-size: 1.25rem;
        margin-bottom: 15px;
    }

    .search-form {
        padding: 12px;
        border-radius: 10px;
    }

    .form-control {
        padding: 10px 12px;
    }

    .btn-toggle {
        padding: 10px 15px;
        font-size: 13px;
        border-radius: 20px;
    }

    .filter-section {
        padding: 12px;
    }

    /* Cards más compactas */
    .collection-item {
        margin-bottom: 15px;
        border-radius: 10px;
    }

    .collection-image {
        height: 160px;
        min-height: 160px;
    }

    .collection-content {
        padding: 12px;
    }

    .collection-title {
        font-size: 15px;
    }

    .collection-meta {
        font-size: 11px;
    }

    .collection-meta i {
        width: 14px;
        font-size: 11px;
    }

    .collection-description {
        font-size: 12px;
        margin: 10px 0;
    }

    .collection-description p {
        max-height: 50px;
    }

    /* Badges más pequeños */
    .status-badge {
        padding: 3px 8px;
        font-size: 10px;
    }

    .material-badge,
    .technique-badge {
        font-size: 9px;
        padding: 2px 8px;
    }

    /* Botones de acción compactos */
    .collection-item .btn-toggle {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Estados especiales compactos */
    .no-results,
    .loading {
        padding: 30px 15px;
        border-radius: 10px;
    }

    .no-results i {
        font-size: 2rem !important;
    }

    .no-results h2 {
        font-size: 1.1rem;
    }

    .loading i {
        font-size: 2rem;
    }

    .loading p {
        font-size: 14px;
    }

    /* Contador de resultados compacto */
    .results-count {
        font-size: 12px;
        padding: 6px 10px;
        margin-bottom: 15px;
    }
}

/* MÓVILES MUY PEQUEÑOS (max-width: 400px) */
@media (max-width: 400px) {
    body {
        margin-top: 90px !important;
    }

    .search-container {
        margin-top: 50px;
        padding: 10px 0;
    }

    .contenedorPag {
        padding: 10px;
        margin: 60px 0px 40px 0px;
        border-radius: 10px;
        border-width: 1px;
    }

    .contenedorPag h1 {
        font-size: 1.1rem;
    }

    .search-form {
        padding: 10px;
    }

    .form-control {
        font-size: 14px;
        padding: 8px 10px;
    }

    .btn-toggle {
        padding: 8px 12px;
        font-size: 12px;
    }

    .collection-image {
        height: 140px;
        min-height: 140px;
    }

    .collection-content {
        padding: 10px;
    }

    .collection-title {
        font-size: 14px;
    }

    .collection-meta {
        font-size: 10px;
    }
}

/* ================================
   ORIENTACIÓN LANDSCAPE EN MÓVILES
   ================================ */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        margin-top: 80px !important;
    }

    .search-container {
        margin-top: 40px;
    }

    .collection-image {
        height: 150px;
    }

    /* Grid de 2 columnas en landscape */
    #resultados .col-lg-4,
    #resultados .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* ================================
   BOTONES DE ACCIÓN RÁPIDA (GLOBAL)
   ================================ */
.btn-info,
.btn-success {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-info:hover,
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: white;
}

.btn-info i,
.btn-success i {
    font-size: 14px;
}

/* ================================
   VISUALIZACIÓN SIMPLIFICADA DE RESULTADOS
   ================================ */
.collection-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
    height: 100%;
}

.collection-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.collection-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.collection-content {
    padding: 20px;
}

.collection-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

.collection-meta {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #666;
}

.collection-meta i {
    width: 16px;
    margin-right: 8px;
    color: #7a322e;
}

.collection-description {
    margin: 15px 0;
    font-size: 0.9rem;
    color: #555;
}

.collection-description p {
    margin-bottom: 0;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-actions {
    margin-top: 15px;
    text-align: center;
}

.btn-group-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ================================
   OPTIMIZACIONES DE RENDIMIENTO
   ================================ */

/* Prevenir Layout Shift (CLS) */
.results-count {
    min-height: 24px;
    line-height: 24px;
}

/* Reservar espacio para imágenes de colección */
.collection-image {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    min-height: 200px;
    background-color: #f0f0f0;
}

/* Reservar espacio para el footer */
.nuevo-footer {
    min-height: 200px;
    contain: layout style;
}

/* Optimización de renderizado para elementos con muchos hijos */
#resultados {
    contain: content;
}

.collection-item {
    contain: layout style;
}

/* Usar will-change solo para elementos que realmente se animan */
.btn-toggle:hover,
.collection-item:hover {
    will-change: transform;
}

/* Lazy loading para imágenes fuera del viewport */
.collection-image[loading="lazy"] {
    content-visibility: auto;
}

/* Reducir repaints en scroll */
#header {
    will-change: background-color;
    backface-visibility: hidden;
}