/* =========================
   PAGE LAYOUT
========================= */

.category-container {
    overflow: visible;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.category-page{
    overflow: visible;
}

.filter-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.filter-sidebar h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.filter-sidebar label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: color .2s ease;
}

.filter-sidebar label:hover {
    color: #007bff;
}

.filter-sidebar input[type="radio"],
.filter-sidebar input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #007bff;
}

.filter-sidebar input[type="text"],
.filter-sidebar input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    margin-top: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color .2s ease, box-shadow .2s ease;
    box-sizing: border-box;
}

.filter-sidebar input[type="text"]:focus,
.filter-sidebar input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, .1);
}

.filter-sidebar .btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.filter-sidebar .btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, .2);
}

.filter-sidebar form>div {
    margin-bottom: 20px;
}

/* =========================
   PRODUCTS GRID
========================= */

.products-list {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    position: relative;
    overflow-y: visible;
}

.category-content {
    flex: 1;
    min-width: 0;
}

.category-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
}

.sort-label {
    white-space: nowrap;
}

.sort-select,
.filter-sidebar select {
    min-width: 230px;
    padding: 10px 40px 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background-color: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #2563eb 50%),
        linear-gradient(135deg, #2563eb 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.sort-select:focus,
.filter-sidebar select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

/* =========================
   PRODUCTS ROW (HORIZONTAL)
========================= */

.products-row {
    flex: 1;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.products-row .product-card-link {
    flex: 0 0 260px;
    scroll-snap-align: start;
}

.products-row::-webkit-scrollbar {
    height: 8px;
}

.products-row::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 999px;
}

.products-row::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.products-row::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================
   PRODUCT CARD
========================= */

.product-card-link {
    text-decoration: none;
    color: inherit;
}

.product-item {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: visible;
    /* ВАЖЛИВО — дозволяє overlay */
    transition: transform .2s ease, box-shadow .2s ease;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .12);
    z-index: 20;
    /* щоб перекривала сусідів */
}

/* =========================
   IMAGE
========================= */

.product-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: #f5f5f5;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================
   INFO
========================= */

.product-info-wrapper {
    padding: 14px;
}

.product-info-wrapper h4 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.product-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.product-price {
    font-size: 15px;
}

/* =========================
   ATTRIBUTES HOVER PANEL
   (ГОЛОВНА МАГІЯ)
========================= */

.product-attributes {

    background-color: white;
    border-radius: 10px;
    padding: 14px;

    border: 1px solid #e5e7eb;

    box-shadow: 0 10px 25px rgba(0, 0, 0, .12);


    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;

    opacity: 0;
    pointer-events: none;

    transform: translateY(20px);
    transition: all .25s ease;

    z-index: 50;
}

/* Показ при hover */
.product-item:hover .product-attributes {
    opacity: 1;
    transform: translateY(100%);
    pointer-events: auto;
}

/* сам блок */
.attributes-list {
    background: white;
    border-radius: 10px;
    padding: 14px;
    margin-top: 10px;

    box-shadow:
        0 20px 40px rgba(0, 0, 0, .18);

    border: 1px solid #e5e7eb;
}

/* атрибути */
.attr-item {
    font-size: 13px;
    margin-top: 6px;
}

.attr-name {
    font-weight: 600;
}

.attr-values {
    color: #555;
}

/* =========================
   RESPONSIVE
========================= */

/* tablet */
@media (max-width: 1024px) {

    .category-container {
        flex-direction: column;
    }

    .filter-sidebar {
        width: 100%;
    }

    .products-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .category-toolbar {
        justify-content: stretch;
    }

    .sort-control {
        width: 100%;
        justify-content: space-between;
    }
}

/* mobile */
@media (max-width: 640px) {

    .category-page h1 {
        font-size: 24px;
        line-height: 1.2;
        margin-bottom: 16px;
    }

    .filter-sidebar {
        padding: 16px;
        margin-bottom: 16px;
    }

    .filter-sidebar h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .filter-sidebar label {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .filter-sidebar input[type="text"],
    .filter-sidebar input[type="number"] {
        padding: 8px 10px;
        font-size: 12px;
    }

    .filter-sidebar .btn {
        padding: 10px;
        font-size: 13px;
    }

    .category-toolbar {
        padding: 10px 12px;
        margin-bottom: 14px;
    }

    .sort-control {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .sort-select,
    .filter-sidebar select {
        min-width: 0;
        width: 100%;
        font-size: 13px;
    }

    .products-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-info-wrapper {
        padding: 10px;
    }

    .product-info-wrapper h4 {
        font-size: 14px;
    }

    .product-description {
        display: none;
    }
}

@media (max-width: 420px) {
    .products-list {
        grid-template-columns: 1fr;
    }

    .product-item {
        border-radius: 10px;
    }
}


/* =========================
   ПРАЙС    ФІЛЬТР
========================= */



.price-filter {
    margin-bottom: 20px;
}

.price-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.price-inputs input {
    width: 100%;
    padding: 6px;
}

.price-slider {
    position: relative;
    height: 35px;
}

.price-slider input[type=range] {
    position: absolute;
    width: 100%;
    pointer-events: none;
    appearance: none;
    background: none;
}

.price-slider input[type=range]::-webkit-slider-thumb {
    pointer-events: all;
    appearance: none;
    height: 16px;
    width: 16px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

.price-slider input[type=range]::-webkit-slider-runnable-track {
    height: 4px;
    background: #ddd;
}

/* =========================
   PAGINATION
========================= */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 2px solid #394f7a;
    border-radius: 8px;
}

.pagination .btn-secondary {
    padding: 11px 20px;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
}

.pagination .btn-secondary:hover:not([style*="opacity"]) {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, .25);
    transform: translateY(-2px);
}

.page-numbers {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin: 0 8px;
}

.page-btn {
    min-width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(.active) {
    background-color: #f0f9ff;
    border-color: #007bff;
    color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, .15);
}

.page-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 700;
    cursor: default;
    box-shadow: 0 4px 12px rgba(0, 123, 255, .25);
}

.page-ellipsis {
    color: #9ca3af;
    padding: 0 6px;
    font-weight: 500;
}

.pagination>p {
    width: 100%;
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    text-align: center;
}
