.products {
    width: 70%;
    margin: auto;
    position: relative;
    padding-bottom: 100px;
}

.products-header {
    font-size: 40px;
    text-align: center;
    line-height: 1.2;
    color: #3b2021;
}

.products-header-container {
    position: relative;
    width: 500px;
    margin: auto;
    margin: 60px auto 40px auto;
}

.products-header::before {
    content: "";
    position: absolute;
    height: 2px;
    width: 150px;
    left: -50px;
    top: 50%;
    background-color: #4d4d4d;
}

.products-header::after {
    content: "";
    position: absolute;
    height: 2px;
    width: 150px;
    right: -50px;
    top: 50%;
    background-color: #4d4d4d;
}

.product-boxes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
    width: 100%;
}

.product-box {
    background-color: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Fill the grid cell */
    position: relative;
    overflow: hidden;
}

.product-box-img {
    border-radius: 10px 10px 0 0;
}

.product-box-name {
    font-size: 18px;
    font-weight: 600;
    margin: 5px 5px 7px 5px;
    color: #121212;
}

.product-box-price {
    font-size: 18px;
    font-weight: 600;
    margin: 0 5px 2px 5px;
    color: #6e4042;
}

.product-box-link {
    font-size: 16px;
    font-weight: 600;
    padding: 10px 20px;
    width: 96%;
    margin: auto auto 15px auto;
    /* Push to bottom */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #663b3d;
    color: white;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, font-size 0.2s ease;
}

.product-box-link:hover {
    background-color: #49c061;
    color: white;
    font-size: 18px;
}

.product-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.products-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.products-filter {
    flex: 0 0 auto;
}

.products-filter-label {
    font-size: 16px;
    color: #3b2021;
}

.products-filter-form {
    display: flex;
    align-items: center;
    gap: 15px;
}

.products-filter-input {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 110px;
}

.products-filter-btn {
    padding: 7px 18px;
    border: none;
    border-radius: 7px;
    background-color: #663b3d;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.products-filter-btn:hover {
    background-color: #49362f;
}

.products-search {
    flex: 0 0 auto;
}

.products-search-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-search-input {
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 250px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.products-search-input:focus {
    outline: none;
    border-color: #663b3d;
}

.products-search-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 7px;
    background-color: #663b3d;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.products-search-btn:hover {
    background-color: #49362f;
}

/* Basit açılış animasyonu */

@keyframes fadeUpSoftProducts {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.products {
    opacity: 0;
    animation: fadeUpSoftProducts 0.7s ease-out forwards;
}

/* Discount Badge Styles */
.product-box {
    position: relative;
    /* Needed for absolute positioning of the badge */
    overflow: hidden;
    /* Keeps content inside the border radius */
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(231, 76, 60, 0.85);
    /* Red transparent background */
    color: white;
    font-weight: 700;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
    margin-right: 8px;
    font-weight: 500;
}

.new-price {
    color: #e74c3c;
    /* Red color for discounted price */
    font-size: 19px;
    font-weight: 700;
}

/* Fix for overlapping long images */
.product-box-img {
    width: 100%;
    height: 250px;
    /* Fixed height container */
    object-fit: contain;
    /* Contain creates letterboxing but shows whole image without checking */
    /* Alternatively use object-fit: cover; if you want to fill the box but crop */
    background-color: #fff;
    /* White background for the empty space */
    display: block;
}

/* -------------------------- RESPONSIVE QUERIES -------------------------- */

@media (max-width: 991px) {
    .products {
        width: 95%;
        padding-bottom: 60px;
    }

    .products-header-container {
        width: 90%;
        margin: 40px auto 30px auto;
    }

    .products-header {
        font-size: 32px;
    }

    .products-header::before,
    .products-header::after {
        width: 60px;
        /* Shorten the lines */
    }

    .products-header::before {
        left: -20px;
    }

    .products-header::after {
        right: -20px;
    }

    /* Controls Wrapper */
    .products-controls-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .products-filter,
    .products-search {
        width: 100%;
    }

    /* Filters */
    .products-filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .products-filter-input {
        width: 100%;
        /* Full width inputs */
        box-sizing: border-box;
    }

    .products-filter-btn {
        width: 100%;
        padding: 10px;
    }

    /* Search */
    .products-search-form {
        width: 100%;
    }

    .products-search-input {
        width: 100%;
        flex: 1;
        box-sizing: border-box;
    }

    .products-search-btn {
        width: auto;
    }

    /* Product Grid */
    .product-boxes-container {
        grid-template-columns: repeat(2, 1fr);
        /* Force 2 columns */
        gap: 15px;
    }

    .product-box {
        width: 100%;
        /* Let grid handle width */
        max-width: none;
        margin-bottom: 0;
    }

    .product-box-img {
        width: 100%;
        height: 180px;
        /* Reduced height for smaller cards */
        object-fit: contain;
        background-color: white;
        border-radius: 10px 10px 0 0;
    }

    .product-box-name {
        font-size: 15px;
        margin-top: 10px;
    }

    .product-box-price {
        font-size: 16px;
    }

    .product-box-link {
        width: 90%;
        font-size: 14px;
        padding: 8px 10px;
    }

    .product-box-link:hover {
        font-size: 14px;
        /* Prevent hover resize breaking layout */
    }
}

@media (max-width: 480px) {
    .product-boxes-container {
        grid-template-columns: repeat(2, 1fr);
        /* Force 2 columns even on small screens */
        gap: 10px;
    }
}