/* ============================================================
    1. ზოგადი სტილები და ფილტრაცია
============================================================ */

/* გვერდის სათაური */
@font-face {
    font-family: 'Alk Sanet';
    src: url('/fonts/alk-sanet.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

.page-header {
    text-align: center;
    padding: 20px 0 30px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
}
.page-header h1 {
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: #222;
}
.page-header p {
    font-size: 1rem;
    color: #666;
    max-width: 500px;
    margin: 0 auto;
}

/* ფილტრების კონტეინერი (დესკტოპი) */
.filter-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
}
.filter-category-btn {
    padding: 8px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.filter-category-btn:hover {
    background-color: #f5f5f5;
    border-color: #333;
}
.filter-category-btn.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

/* სორტირების ფილტრი (დესკტოპი) */
.sort-filter {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.custom-select-wrapper {
    position: relative;
    width: 240px;
}
.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background-color: #fff;
    height: auto;
    min-height: 44px;
}
.custom-select-trigger span {
    font-weight: 500;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.custom-select-trigger i {
    transition: transform 0.3s ease;
}
.custom-select-wrapper.open .custom-select-trigger i {
    transform: rotate(180deg);
}
.custom-options {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.07);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}
.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-option {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.custom-option:hover {
    background-color: #f5f5f5;
}
.custom-option.selected {
    background-color: #f5f5f5;
    font-weight: 600;
}

/* ============================================================
    2. პროდუქტების ბადე და ჩატვირთვის ანიმაცია
============================================================ */
#product-list-container {
    position: relative;
    min-height: 400px;
}
.product-grid-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.product-grid-loader.active {
    opacity: 1;
    visibility: visible;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.product-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
}
.no-products-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    font-size: 1.1rem;
    color: #777;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}

/* ============================================================
    3. პროდუქტის ბარათი (შესწორებული ვერსია)
============================================================ */

.product-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}
.product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.product-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-card__image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background-color: #f5f5f5;
}
.product-card__image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.product-card:hover .product-card__image-wrapper img {
    transform: scale(1.05);
}
.product-card__content {
    padding: 15px;
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-card__title {
    color: #222;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
    height: 2.8em;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    /* <<<< START: თავსებადობის შესწორება >>>> */
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* <<<< END: თავსებადობის შესწორება >>>> */
}

.product-card__price-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 10px;
    gap: 10px;
}

.price-container {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.product-card__price {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
    color: #333; /* ჩვეულებრივი ფასი (ფასდაკლების გარეშე) */
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}

.product-card__price.sale-price {
    color: #e67e22; /* ფასდაკლებული ფასი */
}

.product-card__price.old-price {
    font-size: 0.9rem;
    color: #95a5a6; /* ძველი ფასი */
    font-weight: 400;
}


/* ============================================================
    4. კალათის ღილაკი
============================================================ */
.product-card__cart-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
    flex-shrink: 0;
}
.product-card__cart-btn::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-color: white;
    -webkit-mask-size: 55%;
    mask-size: 55%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    transition: -webkit-mask-image 0.2s ease, mask-image 0.2s ease;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z'/%3E%3C/svg%3E");
}
.product-card__cart-btn:hover {
    background-color: #d4711e;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
}
.product-card__cart-btn:active {
    transform: scale(0.95);
}
.product-card__cart-btn.added {
    background-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.product-card__cart-btn.added::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}
.product-card__cart-btn.error {
    background-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.product-card__cart-btn.error::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
}

/* ============================================================
    5. პაგინაცია
============================================================ */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    padding-bottom: 20px;
}

.pagination {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 8px;
}

.pagination .page-item a,
.pagination .page-item span {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.25s ease-in-out;
    border: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.95rem;
    color: #374151;
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    background-color: #ffffff;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}

.pagination .page-item a svg,
.pagination .page-item span svg {
    width: 20px;
    height: 20px;
}

.pagination .page-item:not(.disabled) a:hover {
    border-color: #e67e22;
    color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.pagination .page-item.active span {
    background-color: #e67e22;
    border-color: #e67e22;
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.3);
}

.pagination .page-item.disabled span {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}


/* ============================================================
    6. მობილურის ფილტრების პანელი
============================================================ */
.mobile-filter-trigger {
    display: none;
}
.filter-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.filter-panel-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.filter-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 90%;
    max-width: 320px;
    height: 100%;
    background-color: #fff;
    z-index: 1002;
    transition: right 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
}
.filter-panel.is-open {
    right: 0;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}
.panel-header h3 {
    font-size: 1.2rem;
    margin: 0;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.close-panel-btn {
    font-size: 2.2rem;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    color: #555;
}
.panel-content {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}
.panel-group {
    margin-bottom: 30px;
}
.panel-group h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.panel-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.panel-option {
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    color: #555;
    border: 1px solid #ddd;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}
.panel-option.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
    font-weight: 600;
}
.panel-footer {
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}
.btn-apply-filters {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    background-color: #e67e22;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
}

/* ============================================================
    7. Responsive ადაპტაცია
============================================================ */

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .desktop-filters {
        display: none;
    }
    .mobile-filter-trigger {
        display: block;
        margin-bottom: 20px;
    }
    .btn-filter {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        font-weight: 700;
        background-color: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-family: 'Alk Sanet', 'Noto Sans Georgian', sans-serif;
    }

    .product-card__title {
        font-size: 0.95rem;
        height: 2.6em;
        line-height: 1.3;
    }

    .price-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .product-card__price {
        font-size: 1rem; /* ვცვლით ზომას მობილურისთვის */
    }

    .product-card__price.sale-price {
        font-size: 1.05rem;
        line-height: 1.2;
    }

    .product-card__price.old-price {
        font-size: 0.8rem;
        line-height: 1;
    }

    .product-card__cart-btn {
        opacity: 1;
        visibility: visible;
        width: 34px;
        height: 34px;
    }
}

/* Tablet (from 769px) */
@media (min-width: 769px) {
    .filter-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .product-card:not(:hover) .product-card__cart-btn {
        opacity: 0;
        visibility: hidden;
        transform: translateX(10px);
        transition: all 0.3s ease;
    }
    .product-card:hover .product-card__cart-btn {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }
}

/* Small Desktop (from 992px) */
@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop (from 1200px) */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}