﻿/* =============================================
   catalog.css — Product Catalog Styles
   Hunter Store · Tienda Virtual
   ============================================= */

/* ---------- FORZAR FONDO GRIS CLARO Y EVITAR SCROLL ---------- */
body {
    background-color: #f3f4f6 !important;
    overflow-x: hidden; /* <-- CRÍTICO: Evita que salga una barra de scroll horizontal abajo */
}

/* ---------- WRAPPER GENERAL ---------- */
.catalog-wrapper {
    background: transparent;
    min-height: 100vh;
    /* 🔥 MAGIA NEGRA AQUÍ: Rompemos la jaula del _Layout.cshtml 🔥 */
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    /* <-- ESOS POCOS CM DE ESPACIO QUE QUIERES A LOS LADOS (2vw = 2% del ancho de la pantalla) */
    padding: 40px 7vw;
    box-sizing: border-box;
}

/* ---------- HEADER DE SECCIÓN ---------- */
.catalog-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
}

.catalog-title-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-icon {
    font-size: 24px;
    line-height: 1;
}

.catalog-title {
    font-size: 34px;
    font-weight: 500; /* <-- AQUÍ ESTÁ: Bajamos de 800 a 500 para que la letra se vea más delgada y elegante */
    color: #000000;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =============================================
   ADMIN BAR (SOLO VISIBLE PARA EL ADMIN)
   ============================================= */
.catalog-admin-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

/* Botón Crear Producto */
.btn-create {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2563eb;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

    .btn-create:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
        color: #fff;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

/* Contenedor del Switch de Ocultos */
.toggle-hidden-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid #e5e7eb; /* Separador delicado entre el botón y el switch */
}

.toggle-label {
    font-weight: 600;
    font-size: 13.5px;
    color: #4b5563;
    white-space: nowrap;
    cursor: pointer;
}

/* Estilo moderno tipo iOS/Android para el Checkbox de Administración */
.toggle-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
    transition: transform 0.1s ease;
}

    .toggle-checkbox:active {
        transform: scale(0.9);
    }

/* ---------- LAYOUT ---------- */
.catalog-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

/* ---------- SIDEBAR FILTROS ---------- */
.filter-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    /* Sube este valor para que el header no lo aplaste. 
       Dependiendo de la altura de tu header, 100px o 120px suele ser el punto dulce. */
    top: 120px;
}

.filter-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    min-height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.filter-heading {
    font-size: 17px;
    font-weight: 800;
    color: #374151;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-icon {
    font-size: 18px;
}

/* GRUPOS */
.filter-group {
    margin-bottom: 28px;
}

.filter-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* COLOR CHIPS */
.color-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

.color-chip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    font-size: 0;
    padding: 0;
}

    .color-chip.chip-all {
        background: #f0f2f5;
        color: #2563eb;
        font-size: 11px;
        font-weight: 800;
        border: 2.5px solid #2563eb;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .color-chip.chip-all.active,
        .color-chip.chip-all:hover {
            background: #2563eb;
            color: #fff;
        }

    .color-chip.light {
        border: 2.5px solid #d1d5db;
    }

    .color-chip.active {
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
        transform: scale(1.12);
    }

    .color-chip:hover {
        transform: scale(1.08);
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    }

/* SIZE CHIPS */
.size-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-chip {
    min-width: 44px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .size-chip.active {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
        box-shadow: 0 3px 10px rgba(37,99,235,0.3);
    }

    .size-chip:hover:not(.active) {
        border-color: #2563eb;
        color: #2563eb;
    }

/* AVAILABILITY TOGGLE */
.availability-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-top: -10px;
}

.toggle-text {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

.toggle-track {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 50px;
    transition: background 0.25s;
    cursor: pointer;
}

    .toggle-track::before {
        content: "";
        position: absolute;
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        top: 3px;
        left: 3px;
        transition: transform 0.25s;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }

.toggle-switch input:checked + .toggle-track {
    background: #2563eb;
}

    .toggle-switch input:checked + .toggle-track::before {
        transform: translateX(20px);
    }

/* BOTONES FILTRO */
.btn-apply {
    width: 100%;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
    margin-top: 4px;
}

    .btn-apply:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
    }

.btn-clear {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    padding: 11px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

    .btn-clear:hover {
        border-color: #9ca3af;
        color: #374151;
        text-decoration: none;
    }

/* ---------- HEADER DE PRODUCTOS ---------- */
.products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.title-and-admin {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* =============================================
   SORT BLOCK (LISTA EMBELLECIDA REDONDA - MODO FORZADO)
   ============================================= */
.sort-block {
    display: flex !important;
    align-items: center !important;
}

    /* Apuntamos a la clase y a la etiqueta form por si acaso */
    .sort-block form,
    .sort-form {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        background: #ffffff !important;
        padding: 6px 18px !important;
        border-radius: 50px !important; /* 🔥 PÍLDORA REDONDA FORZADA */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
        border: 1px solid #e5e7eb !important;
        transition: all 0.3s ease !important;
        margin: 0 !important;
        height: 40px !important; /* Altura fija para asegurar la forma redonda */
    }

        .sort-block form:hover,
        .sort-form:hover {
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1) !important;
            border-color: #d1d5db !important;
            transform: translateY(-1px) !important;
        }

.sort-label {
    font-weight: 500 !important;
    font-size: 13px !important;
    color: #6b7280 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

    .sort-label i {
        color: #9ca3af !important;
        font-size: 14px !important;
    }

/* Apuntamos a la clase y al select directamente */
.sort-block select,
.sort-select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    /* Flecha limpia gris */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right center !important;
    padding: 0 18px 0 0 !important; /* Espacio para la flecha */
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    cursor: pointer !important;
    width: auto !important;
}

    .sort-block select:focus,
    .sort-select:focus {
        outline: none !important;
        border: none !important;
        box-shadow: none !important;
        background-color: transparent !important;
    }
/* ---------- SECCIÓN PRODUCTOS ---------- */
.products-section {
    flex: 1;
    min-width: 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

/* ---------- PAGINACIÓN ---------- */
.catalog-pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
}

.pagination-list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    background: #fff;
    border: 2px solid #e5e7eb;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

    .page-btn:hover {
        border-color: #2563eb;
        color: #2563eb;
        text-decoration: none;
    }

    .page-btn.active {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
        box-shadow: 0 3px 10px rgba(37,99,235,0.35);
    }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .catalog-layout {
        flex-direction: column;
    }

    .filter-sidebar {
        width: 100%;
        position: static;
    }

    .filter-card {
        padding: 20px;
        margin-bottom: 20px;
    }

    /* AQUÍ ESTÁ EL TRUCO: Mantenemos el título y el "ordenar" en la misma línea */
    .products-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .catalog-wrapper {
        padding: 20px 14px 40px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .catalog-title {
        font-size: 20px; /* Un chin más pequeño para que quepa con el filtro */
    }

    /* --- FILTROS COMPACTOS EN MÓVIL --- */
    .filter-card {
        padding: 16px; /* Menos relleno */
        margin-bottom: 16px;
    }

    .filter-heading {
        font-size: 15px;
        margin-bottom: 14px;
    }

    .filter-group {
        margin-bottom: 20px;
    }

    .color-chips {
        /* Hacemos que quepan más bolitas por fila en móvil */
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }

    .color-chip {
        width: 30px; /* Bolitas más pequeñas */
        height: 30px;
    }

    .size-chip {
        min-width: 36px; /* Tallas más compactas */
        height: 30px;
        font-size: 12px;
        padding: 0 8px;
    }

    .availability-toggle {
        padding: 8px 12px; /* Switcher más pequeño */
    }

    .toggle-text {
        font-size: 13px;
    }

    .btn-apply, .btn-clear {
        padding: 10px;
        font-size: 13px;
    }

    /* --- "ORDENAR POR" PEQUEÑO Y A LA DERECHA (MÓVIL MODO FORZADO) --- */
    .sort-block form,
    .sort-form {
        padding: 4px 14px !important;
        gap: 6px !important;
        height: 36px !important;
        border-radius: 50px !important; /* Redondo en móvil también */
    }

    .sort-label {
        font-size: 12px !important;
    }

        .sort-label i {
            display: none !important; /* Ocultamos el icono en móvil */
        }

    .sort-block select,
    .sort-select {
        font-size: 12px !important;
        padding-right: 16px !important;
    }
}
