/* ============================================ */
/* ARCA ENERGIES - Catálogo CSS                 */
/* ============================================ */

:root {
    --blanco: #FFFFFF;
    --gris-claro: #f4f6f8;
    --gris-borde: #e0e3e6;
    --gris: #656C70;
    --gris-oscuro: #4B5563;
    --negro: #111827;
    --texto: #1F2937;
    --texto-secundario: #6B7280;
    --fondo: #F9FAFB;
    --fondo-alt: #F3F4F6;
    --azul: #084D9C;
    --azul-hover: #063d7e;
    --azul-light: #e0e9f0;
    --azul-oscuro: #052C5C;
    --azul-medio: #1E40AF;
    --azul-claro: #DBEAFE;
    --verde: #2EB72E;
    --verde-hover: #249a24;
    --verde-light: #DCFCE7;
    --verde-oscuro: #166534;
    --verde-medio: #22C55E;
    --naranja: #F59E0B;
    --naranja-hover: #D97706;
    --naranja-light: #FEF3C7;
    --amarillo: #FBBF24;
    --rojo: #EF4444;
    --rojo-hover: #DC2626;
    --rojo-light: #FEE2E2;
    --morado: #8B5CF6;
    --morado-light: #EDE9FE;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
}

/* HERO CAROUSEL - CORRECCIÓN PROFESIONAL */
.hero-carousel {
    position: relative; /* Cambiado de absolute a relative para respetar el flujo */
    width: 100%;
    height: 400px;
    background: var(--azul-oscuro); /* Fondo de respaldo oscuro */
    overflow: visible;
    margin: 0;
    padding: 0;
}

.carousel-container {
    position: relative;
    width: 100%;
    /* Altura dinámica basada en proporción 21:9 (panorámico industrial) */
    aspect-ratio: 21/9; 
    max-height: 65vh; /* Límite para móviles verticales */
    min-height: 300px; /* Mínimo para que no se aplaste */
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Rellena el contenedor sin deformar ni dejar blancos */
    object-position: center;
    filter: brightness(0.8);
    display: block;
}

/* TEXTO CENTRADO MATEMÁTICAMENTE */
.carousel-content {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Esto centra el bloque contenedor exactamente en el medio */
    transform: translate(-50%, -50%); 
    
    /* ESTO ES LO QUE FALTABA: Asegura que el texto interno esté centrado */
    text-align: center; 
    display: flex;           /* Usamos flexbox para alinear los elementos internos */
    flex-direction: column;  /* Uno debajo del otro */
    align-items: center;     /* Centrado horizontal perfecto de h1 y p */
    justify-content: center; /* Centrado vertical si hubiera espacio extra */
    
    color: white;
    z-index: 3;
    padding: 20px;
    max-width: 1900px;
    width: 90%;
    pointer-events: none;
}

/* Asegura que el título no tenga márgenes raros que lo desplacen */
.carousel-content h1 {
    margin: 0 0 15px 0; /* Margen inferior controlado */
    text-align: center; /* Refuerzo de centrado */
    width: 100%;
}

/* Asegura que la descripción esté alineada */
.carousel-content p {
    margin: 0;
    text-align: center; /* Refuerzo de centrado */
    width: 100%;
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, -40%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* BOTONES Y PUNTOS (Ajustados para no salirse del banner) */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    width: clamp(40px, 5vw, 60px);
    height: clamp(40px, 5vw, 60px);
    border-radius: 50%;
    cursor: pointer;
    font-size: clamp(1.5rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.carousel-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev { left: clamp(10px, 3vw, 30px); }
.carousel-next { right: clamp(10px, 3vw, 30px); }

.carousel-dots {
    position: absolute;
    bottom: clamp(10px, 3vh, 30px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.carousel-dot {
    width: clamp(8px, 1.5vw, 15px);
    height: clamp(8px, 1.5vw, 15px);
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    padding: 0;
}

.carousel-dot.active {
    background: var(--verde);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(46,183,46,0.5);
}

/* SEARCH */
.search-container {
    max-width: 550px;
    margin: -10px auto 10px;
    position: relative;
    z-index: 10;
    padding: 0 25px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 24px 65px 24px 32px;
    border-radius: 60px;
    border: 3px solid transparent;
    box-shadow: 0 15px 40px rgba(0,0,0,0.18);
    font-size: 1.35rem;
    font-family: 'Montserrat', sans-serif;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.search-input:focus {
    border-color: var(--naranja);
    box-shadow: 0 15px 40px rgba(0,0,0,0.18), 0 0 0 5px rgba(46,183,46,0.12);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gris-oscuro);
    pointer-events: none;
    transition: color 0.3s, transform 0.3s;
}

.search-input:focus ~ .search-icon {
    color: var(--azul);
    transform: translateY(-50%) scale(1.15);
}

/* SEARCH DROPDOWN */
.search-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: var(--blanco);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    border: 2px solid var(--gris-borde);
    max-height: 480px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    animation: dropdownFadeIn 0.2s ease;
}

.search-dropdown.visible {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-dropdown-header {
    padding: 12px 20px 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--gris);
    letter-spacing: 1px;
}

.search-dropdown-divider {
    height: 1px;
    background: var(--gris-borde);
    margin: 6px 16px;
}

.search-dropdown-item {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: background 0.15s;
    border-left: 4px solid transparent;
}

.search-dropdown-item:hover,
.search-dropdown-item.highlighted {
    background: var(--gris-claro);
    border-left-color: var(--naranja);
}

.search-dropdown-item .item-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--gris-claro);
}

.search-dropdown-item .item-info {
    flex: 1;
    min-width: 0;
}

.search-dropdown-item .item-ref {
    font-size: 0.8rem;
    color: var(--gris);
    font-weight: 600;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown-item .item-name {
    font-size: 1rem;
    color: var(--texto);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown-item .item-name mark {
    background: var(--amarillo);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.search-dropdown-item .item-brand-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--gris-claro);
    color: var(--gris);
    flex-shrink: 0;
}

.search-dropdown-item .item-brand-badge.bg-invertek { color: var(--morado); background: var(--morado-light); }
.search-dropdown-item .item-brand-badge.bg-schrack { color: var(--azul); background: var(--azul-light); }
.search-dropdown-item .item-brand-badge.bg-murr { color: var(--verde); background: var(--verde-light); }

.search-dropdown-cat-item {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: background 0.15s;
    border-left: 4px solid transparent;
}

.search-dropdown-cat-item:hover,
.search-dropdown-cat-item.highlighted {
    background: var(--gris-claro);
    border-left-color: var(--verde);
}

.search-dropdown-cat-item .cat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--azul-light);
    color: var(--azul);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.search-dropdown-cat-item .cat-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--texto);
}

.search-dropdown-cat-item .cat-count {
    font-size: 0.8rem;
    color: var(--gris);
}

.search-dropdown-no-results {
    padding: 32px 20px;
    text-align: center;
    color: var(--naranja);
}

.search-dropdown-no-results .no-results-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

/* MAIN CONTAINER */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px 60px;
    flex: 1;
}

/* TABS */
.tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 25px;
    background: var(--blanco);
    border: 2px solid var(--gris-borde);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s;
    font-size: 0.95rem;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tab.active {
    background: var(--azul);
    color: var(--blanco);
    border-color: var(--azul);
}

.tab:hover:not(.active) { border-color: var(--azul); color: var(--azul); }

/* SUB TABS */
.sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.sub-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--gris-borde);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gris);
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.sub-tab.active {
    background: var(--gris-claro);
    border-color: var(--gris);
    color: var(--azul);
}

.sub-tab:hover { border-color: var(--azul); }

/* GRID */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

/* CARD */
.card {
    background: var(--gris-claro);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gris-borde);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--verde);
}

.card-image-container {
    height: 200px;
    background: #eee;
    position: relative;
    overflow: hidden;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.card:hover .card-image-container img {
    transform: scale(1.05);
}

.brand-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.bg-invertek { color: var(--morado); }
.bg-schrack { color: var(--azul); }
.bg-murr { color: var(--verde); }

.card-header {
    padding: 15px 20px 5px;
    border-bottom: 1px solid var(--gris-borde);
}

.card-ref {
    font-size: 0.75rem;
    color: var(--gris);
    font-weight: 600;
    margin-bottom: 5px;
    font-family: monospace;
    background: #f0f2f5;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}

.card-title {
    font-size: 1.05rem;
    color: var(--texto);
    font-weight: 800;
    margin-bottom: 0;
    line-height: 1.3;
}

.card-body {
    padding: 15px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--gris);
    line-height: 1.5;
    margin-bottom: 12px;
}

.specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.spec-chip {
    background: var(--gris-claro);
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--gris);
    border: 1px solid var(--gris-borde);
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
}

.btn-cotizar-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--amarillo);
    color: white;
    padding: 12px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;
}

.btn-cotizar-card:hover {
    background: var(--verde-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46,183,46,0.25);
}

.btn-descargar-ficha {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--azul);
    color: white;
    padding: 12px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(8,77,156,0.15);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    font-family: 'Montserrat', sans-serif;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn-descargar-ficha:hover {
    background: var(--azul-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(8,77,156,0.3);
}

.btn-descargar-ficha svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.no-results {
    text-align: center;
    padding: 50px;
    grid-column: 1 / -1;
    color: var(--gris);
}

.no-results h3 { margin-bottom: 10px; font-size: 1.2rem; }
.no-results p { font-size: 0.9rem; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .hero-carousel { height: 500px; }
    .carousel-content h1 { font-size: 2.8rem; }
    .carousel-content p { font-size: 1.2rem; }
    .container { padding: 0 20px 50px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
    .search-container { max-width: 700px; padding: 0 20px; }
    .search-input { padding: 20px 55px 20px 26px; font-size: 1.2rem; }
}

@media (max-width: 768px) {
    .hero-carousel { height: 380px; }
    .carousel-content h1 { font-size: 1.8rem; margin-bottom: 12px; }
    .carousel-content p { font-size: 1rem; animation: none; }
    .carousel-btn { width: 40px; height: 40px; font-size: 1.5rem; }
    .carousel-prev { left: 10px; }
    .carousel-next { right: 10px; }
    .carousel-dots { bottom: 15px; }
    .carousel-dot { width: 12px; height: 12px; }
    .search-container { margin: -30px auto 25px; padding: 0 15px; max-width: 100%; }
    .search-input { padding: 16px 50px 16px 22px; font-size: 1.1rem; border-radius: 50px; }
    .search-icon { right: 18px; }
    .container { padding: 0 15px 40px; }
    .tabs { gap: 8px; margin-bottom: 20px; }
    .tab { padding: 10px 18px; font-size: 0.85rem; }
    .sub-tabs { gap: 6px; margin-bottom: 20px; }
    .sub-tab { padding: 6px 12px; font-size: 0.8rem; }
    .grid { grid-template-columns: 1fr; gap: 18px; }
    .card-image-container { height: 200px; }
    .card-actions { flex-direction: column; }
    .btn-cotizar-card, .btn-descargar-ficha { padding: 12px; }
}

@media (max-width: 480px) {
    .hero-carousel { height: 300px; }
    .carousel-content { padding: 15px; width: 95%; }
    .carousel-content h1 { font-size: 1.5rem; margin-bottom: 8px; }
    .carousel-content p { font-size: 0.9rem; }
    .carousel-btn { width: 36px; height: 36px; font-size: 1.3rem; }
    .carousel-prev { left: 8px; }
    .carousel-next { right: 8px; }
    .search-container { margin: -25px auto 15px; padding: 0 12px; }
    .search-input { padding: 14px 45px 14px 18px; font-size: 1rem; border-radius: 45px; }
    .search-icon { right: 14px; width: 20px; height: 20px; }
    .container { padding: 0 12px 30px; }
    .tabs { gap: 6px; margin-bottom: 15px; }
    .tab { padding: 8px 14px; font-size: 0.8rem; }
    .sub-tabs { gap: 5px; margin-bottom: 15px; }
    .sub-tab { padding: 5px 10px; font-size: 0.75rem; }
    .card-header { padding: 12px 15px 5px; }
    .card-body { padding: 12px 15px; }
    .card-title { font-size: 0.95rem; }
    .card-desc { font-size: 0.8rem; }
    .card-image-container { height: 180px; }
    .no-results { padding: 30px; }
    .search-dropdown { max-height: 320px; border-radius: 12px; }
}