/* =====================================================
   CATALOG PAGE STYLES
   ===================================================== */
.catalog-page {
    background-color: var(--black);
    min-height: 100vh;
}

.catalog-header {
    padding: 140px 0 60px;
    background: radial-gradient(circle at center 30%, rgba(34, 197, 94, 0.1) 0%, transparent 70%);
}

/* =====================================================
   SMART SEARCH BAR
   ===================================================== */
.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 50px;
    padding: 4px 12px 4px 20px;
    transition: all 0.3s ease;
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-sizing: border-box;
}

.search-container:focus-within {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2), 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.search-icon {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.search-container:focus-within .search-icon {
    color: var(--primary);
}

.search-input {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 16px; /* Fundamental: 16px previene el auto-zoom en iOS Safari que descoloca el cursor */
    line-height: 1.5;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-clear {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.search-clear.visible {
    opacity: 1;
    visibility: visible;
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* =====================================================
   CATALOG GRID & HEADERS
   ===================================================== */
.catalog-category-block {
    margin-bottom: 80px;
}

/* =====================================================
   ACORDEÓN NIVEL 1: MACRO-CATEGORÍAS (Verde neón prominente)
   ===================================================== */
.catalog-macro-block {
    margin-bottom: 20px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid rgba(34, 197, 94, 0.25);
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.08);
}

.catalog-macro-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.04) 100%);
    border-bottom: 2px solid rgba(34, 197, 94, 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
    letter-spacing: 0.5px;
}

.catalog-macro-title:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.08) 100%);
    border-color: rgba(34, 197, 94, 0.6);
}

.catalog-macro-title span {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--primary);
}

.catalog-macro-title span i {
    font-size: 1.5rem;
}

.macro-toggle-icon {
    font-size: 1.4rem;
    color: var(--primary);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-macro-title.expanded .macro-toggle-icon {
    transform: rotate(180deg);
}

.catalog-macro-content {
    padding: 16px 20px 4px 20px;
    background: rgba(0, 0, 0, 0.15);
}

/* =====================================================
   ACORDEÓN NIVEL 2: CATEGORÍAS (Verde moderado)
   ===================================================== */
.catalog-category-block {
    margin-bottom: 10px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid rgba(34, 197, 94, 0.12);
}

.catalog-category-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    padding: 14px 18px;
    background: rgba(34, 197, 94, 0.05);
    border-bottom: 1px solid rgba(34, 197, 94, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.catalog-category-title:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.catalog-category-title span {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-category-title span::before {
    content: '';
    display: block;
    width: 4px;
    height: 22px;
    background: rgba(34, 197, 94, 0.6);
    border-radius: 3px;
}

.category-toggle-icon {
    font-size: 1.1rem;
    color: rgba(34, 197, 94, 0.7);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-category-title.expanded .category-toggle-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.catalog-category-content {
    padding: 12px 16px 4px 16px;
    background: rgba(0, 0, 0, 0.2);
}

/* =====================================================
   ACORDEÓN NIVEL 3: MARCAS (Glassmorphism sutil)
   ===================================================== */
.catalog-brand-block {
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
}

.catalog-brand-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
}

.catalog-brand-title:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--text-main);
}

.catalog-brand-title.expanded {
    color: var(--text-main);
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.catalog-brand-title span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.catalog-brand-title span i {
    color: rgba(34, 197, 94, 0.5);
    font-size: 0.9rem;
}

.brand-toggle-icon {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-brand-title.expanded .brand-toggle-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.catalog-brand-content {
    padding: 12px 0 8px 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}


/* =====================================================
   PRODUCT CARDS (Migrated from main styles)
   ===================================================== */
.product-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.3s ease, border-color 0.3s ease;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: rgba(var(--primary-rgb), 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(var(--primary-rgb), 0.1);
}

.product-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
}

.product-image-wrapper {
    width: 100%;
    height: 180px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 0 0 1px rgba(34, 197, 94, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card:hover .product-image-wrapper {
    border-color: rgba(34, 197, 94, 0.25);
    box-shadow:
        inset 0 0 0 1px rgba(34, 197, 94, 0.15),
        0 8px 32px rgba(34, 197, 94, 0.1);
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    border-radius: 15px; /* 1px menos que el wrapper para evitar bleeding */
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.product-image-placeholder {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    opacity: 0.5;
}

/* Link oficial del producto */
.product-official-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--primary);
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    width: 100%;
    justify-content: center;
}

.product-official-link:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.55);
    color: #fff;
}

.product-official-link i {
    font-size: 0.75rem;
}

/* Variante de búsqueda automática (tono más discreto) */
.product-official-link--search {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.product-official-link--search:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-location.active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--primary);
    border-color: rgba(34, 197, 94, 0.3);
}

.badge-location.low-stock {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.badge-warranty {
    color: #60A5FA;
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.05);
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
}

.product-price {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* =====================================================
   CORE SYNC LOADER (Tech Radar Animation)
   ===================================================== */
.catalog-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 0;
    width: 100%;
}

.tech-loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tech-loader-core {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary);
    animation: corePulse 2s ease-in-out infinite alternate;
}

.tech-loader-ring {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
    border-top-color: var(--primary);
    border-bottom-color: rgba(34, 197, 94, 0.3);
    animation: spin 3s linear infinite;
}

.ring-1 { width: 40px; height: 40px; animation-duration: 2s; }
.ring-2 { width: 70px; height: 70px; animation-direction: reverse; animation-duration: 3s; border-top-color: rgba(34, 197, 94, 0.6); }
.ring-3 { width: 100px; height: 100px; animation-duration: 4s; border-bottom-color: transparent; border-left-color: rgba(34, 197, 94, 0.2); }

.tech-loader-text {
    text-align: center;
}

.glitch-title {
    font-family: var(--font-mono);
    color: var(--primary);
    font-size: 1.1rem;
    letter-spacing: 4px;
    margin: 0 0 8px 0;
    animation: textFlicker 3s linear infinite;
}

.loading-subtitle {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin: 0;
}

.loading-dots {
    display: inline-block;
    width: 12px;
    text-align: left;
    overflow: hidden;
    vertical-align: bottom;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes corePulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 30px var(--primary), 0 0 60px var(--primary); }
}

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

@keyframes textFlicker {
    0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(34, 197, 94, 0.5); }
    20%, 21.999%, 63%, 63.999%, 65%, 69.999% { opacity: 0.4; text-shadow: none; }
}

@keyframes dots {
    0% { width: 0px; }
    100% { width: 12px; }
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    margin-top: 40px;
}

@media (max-width: 768px) {
    .catalog-header {
        padding: 100px 0 40px;
    }
    .hero-title {
        font-size: 2.2rem !important;
    }
    .catalog-macro-title {
        font-size: 1.5rem;
        padding: 16px 18px;
    }
    .catalog-macro-content {
        padding: 10px 10px 4px 10px;
    }
    .catalog-category-title {
        font-size: 1.1rem;
        padding: 12px 14px;
    }
    .catalog-category-content {
        padding: 8px 8px 4px 8px;
    }
    .catalog-brand-title {
        font-size: 0.95rem;
        padding: 10px 12px;
    }
    .category-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .product-image-wrapper {
        border-radius: 24px; /* Efecto burbuja más pronunciado en móviles */
        height: 200px;
    }
    .product-image-wrapper img {
        border-radius: 23px;
    }
}
