/* ============================================================
   CATÁLOGO DE PRODUCTOS - TEMA OFICIAL LA CASA DEL TORNILLO
   Paleta: #0A2540 (Dark Navy), #013183 (Royal Blue), #FDC101 (Flexómetro Yellow)
   Fuentes: Outfit (headings), Inter / Plus Jakarta Sans (body)
   ============================================================ */

/* --- Variables (consistentes con variables.css de la página principal) --- */
:root {
    --primary: #013183;
    --primary-navy: #0A2540;
    --accent-gold: #FDC101;
    --accent-gold-hover: #E5A800;
    --text-light: #0F172A;
    --text-muted: #475569;
    --bg-page: #F8FAFC;
    --bg-card: #FFFFFF;
    --border-light: #E2E8F0;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 8px 25px rgba(1, 49, 131, 0.2);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', 'Plus Jakarta Sans', sans-serif;
    --wa-green: #25D366;
    --wa-green-hover: #128C7E;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

a {
    text-decoration: none;
    color: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================================
   HEADER — Navbar estilo principal con gradiente navy → royal blue
   ============================================================ */
.catalog-header {
    background: linear-gradient(135deg, #0A2540 0%, #013183 100%);
    border-bottom: 3px solid #FDC101;
    color: #FFFFFF;
    padding: 0;
    position: relative;
    overflow: hidden;
}

/* Tuercas doradas decorativas en los extremos de la línea dorada */
.catalog-header::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 2px;
    width: 25px;
    height: 25px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23FDC101' stroke='%230F172A' stroke-width='2'%3E%3Cpolygon points='12 2 21 7 21 17 12 22 3 17 3 7 12 2'%3E%3C/polygon%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%230A2540'%3E%3C/circle%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.catalog-header::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 2px;
    width: 25px;
    height: 25px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23FDC101' stroke='%230F172A' stroke-width='2'%3E%3Cpolygon points='12 2 21 7 21 17 12 22 3 17 3 7 12 2'%3E%3C/polygon%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%230A2540'%3E%3C/circle%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px 50px;
    position: relative;
    z-index: 1;
}

/* Logo + Volver al Inicio */
.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #FFFFFF;
    margin-bottom: 30px;
    transition: var(--transition);
}

.logo-link:hover {
    opacity: 0.85;
}

.logo {
    height: 56px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.back-home {
    font-size: 13px;
    font-weight: 700;
    padding: 7px 16px;
    background: rgba(253, 193, 1, 0.15);
    border: 1px solid rgba(253, 193, 1, 0.4);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
    color: #FDC101;
    transition: var(--transition);
}

.logo-link:hover .back-home {
    background: rgba(253, 193, 1, 0.25);
}

/* Título y Subtítulo — estilo chaflán como la página principal */
.header-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.catalog-title {
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 900;
    color: #FFFFFF;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.catalog-title span {
    color: #FDC101;
}

.catalog-subtitle {
    font-size: clamp(14px, 2.5vw, 17px);
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 30px;
    font-weight: 400;
}

/* ============================================================
   BUSCADOR — Barra de búsqueda premium con borde dorado en focus
   ============================================================ */
.search-container {
    max-width: 650px;
    margin: 0 auto;
}

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

.search-icon {
    position: absolute;
    left: 20px;
    color: #475569;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    font-size: 15px;
    font-family: var(--font-body);
    font-weight: 500;
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

#searchInput::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

#searchInput:focus {
    outline: none;
    border-color: #FDC101;
    box-shadow: 0 8px 32px rgba(253, 193, 1, 0.25), 0 0 0 3px rgba(253, 193, 1, 0.15);
}

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */
.catalog-main {
    max-width: 1400px;
    margin: -24px auto 60px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.catalog-container {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    padding: 30px;
    min-height: 500px;
    border: 1px solid var(--border-light);
}

/* ============================================================
   FILTROS DE CATEGORÍA — Pills/Tabs con estilo de la página principal
   ============================================================ */
.filter-section {
    margin-bottom: 24px;
}

.categories-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.categories-scroll::-webkit-scrollbar {
    height: 5px;
}

.categories-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.categories-scroll::-webkit-scrollbar-thumb {
    background-color: #CBD5E1;
    border-radius: var(--radius-full);
}

.categories-container {
    display: flex;
    gap: 8px;
    min-width: min-content;
}

.category-btn {
    background: #F1F5F9;
    border: 1.5px solid #E2E8F0;
    color: #0A2540;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.category-btn:hover {
    background: #E2E8F0;
    border-color: #013183;
    color: #013183;
}

.category-btn.active {
    background: linear-gradient(135deg, #0A2540 0%, #013183 100%);
    color: #FFFFFF;
    border-color: #FDC101;
    box-shadow: 0 4px 15px rgba(1, 49, 131, 0.35);
}

.category-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #0A2540;
    transition: var(--transition);
}

.category-btn:hover svg {
    stroke: #013183;
}

.category-btn.active svg {
    stroke: #FDC101;
}

/* ============================================================
   RESULTADOS INFO
   ============================================================ */
.results-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.results-info p {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.results-info #productCount {
    font-weight: 800;
    color: #013183;
}

/* ============================================================
   GRID DE PRODUCTOS — Tarjetas estilo navy con borde dorado
   (Idéntico al .product-card de la página principal)
   ============================================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 24px;
}

.product-card {
    background: linear-gradient(145deg, #0A2540 0%, #013183 100%);
    border: 1.5px solid rgba(253, 193, 1, 0.25);
    border-radius: var(--radius-lg);
    padding: 22px 20px 20px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    box-shadow: 0 10px 28px rgba(1, 49, 131, 0.16);
    overflow: hidden;
}

/* Barra dorada superior (idéntica a la página principal) */
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #FDC101 0%, #FFE838 100%);
    opacity: 0.85;
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: #FDC101;
    box-shadow: 0 18px 40px rgba(1, 49, 131, 0.32);
}

/* Badge de categoría */
.product-category-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #0A2540 0%, #013183 100%);
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 10px;
    padding: 5px 14px 5px 10px;
    margin-bottom: 12px;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    align-self: flex-start;
    border: 1px solid rgba(253, 193, 1, 0.4);
}

/* Image Container */
.product-image-box {
    width: 100%;
    height: 195px;
    background: #FFFFFF;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin-bottom: 14px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.product-image-box img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform: scale(1.08);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-image-box {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.product-card:hover .product-image-box img {
    transform: scale(1.18);
}

/* Nombre del producto */
.product-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Especificaciones */
.product-specs {
    font-size: 12.5px;
    color: #CBD5E1;
    margin-bottom: 12px;
    flex-grow: 1;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Medidas disponibles */
.product-sizes-title {
    font-size: 11px;
    font-weight: 800;
    color: #FDC101;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 16px;
}

.size-pill {
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.size-pill:hover {
    background: rgba(253, 193, 1, 0.15);
    border-color: rgba(253, 193, 1, 0.4);
    color: #FDC101;
}

/* Botón "Cotizar por WhatsApp" — Estilo dorado como la página principal */
.product-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #FDC101 0%, #E5A800 100%);
    color: #0A2540;
    text-decoration: none;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(253, 193, 1, 0.35);
    transition: var(--transition);
    margin-top: auto;
    min-height: 44px;
}

.product-btn:hover {
    background: #FFFFFF;
    color: #013183;
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.product-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================================
   ESTADOS VACÍOS & LOADER
   ============================================================ */
.loader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results svg {
    margin-bottom: 16px;
    opacity: 0.4;
    stroke: #013183;
}

.no-results h3 {
    font-family: var(--font-heading);
    color: #0A2540;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.no-results p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================================
   BOTÓN FLOTANTE WHATSAPP — Estilo consistente con la página principal
   ============================================================ */
.floating-wa {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #FFFFFF;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
    z-index: 100;
    transition: var(--transition);
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.floating-wa:hover {
    transform: scale(1.12) translateY(-4px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.6);
}

/* ============================================================
   RESPONSIVE — Breakpoints idénticos a la página principal
   ============================================================ */

/* Tablets */
@media (max-width: 992px) {
    .header-container {
        padding: 16px 20px 40px;
    }

    .catalog-title {
        font-size: clamp(24px, 5vw, 36px);
    }

    .catalog-container {
        padding: 24px 20px;
    }
}

/* Tablets pequeñas */
@media (max-width: 768px) {
    .catalog-container {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
        gap: 16px;
    }

    .category-btn {
        padding: 7px 14px;
        font-size: 12px;
    }

    .floating-wa {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

/* Móviles */
@media (max-width: 576px) {
    .header-container {
        padding: 14px 16px 36px;
    }

    .logo {
        height: 44px;
    }

    .back-home {
        font-size: 11px;
        padding: 5px 12px;
    }

    .catalog-main {
        padding: 0 12px;
        margin-top: -20px;
    }

    .catalog-container {
        padding: 16px 12px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .product-card {
        padding: 18px 16px 16px;
    }

    #searchInput {
        padding: 14px 16px 14px 46px;
        font-size: 14px;
    }

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

/* Pantallas ultra pequeñas (320px) */
@media (max-width: 375px) {
    .catalog-title {
        font-size: 22px;
    }

    .catalog-subtitle {
        font-size: 13px;
    }

    .product-name {
        font-size: 15px;
    }

    .product-btn {
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Pantallas grandes (1920px+) */
@media (min-width: 1920px) {
    .header-container,
    .catalog-main {
        max-width: 1600px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}
