.products {
    padding: 0 24px;
    margin-top: 15px;
}

.section-title {
    font-size: 28px;
    margin-bottom: 10px;
}

.products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--bg-white);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.product-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-name {
    font-size: 20px;
    font-weight: 700;
}

.product-desc {
    font-size: 14px;
    color: var(--text-desc);
    line-height: 1.4;
}

.product-unit {
    font-size: 14px;
    font-weight: 600;
    margin-top: 6px;
}

.product-qty {
    display: grid;
    grid-template-columns: auto 160px auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--text-dark);
    color: var(--bg-white);
    font-size: 16px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: 0.2s ease;
}

.qty-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

.qty-input {
    width: 100%;
    height: 34px;
    background: var(--bg-soft);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    text-align: center;
    outline: none;

    transition: 0.2s ease;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.product-price-label {
    font-size: 14px;
    color: var(--text-light);
}

.product-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}

.add-cart-btn {
    background: var(--text-dark);
    color: var(--bg-white);
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.add-cart-btn:hover {
    background: var(--primary);
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
    z-index: 1000;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -10px 0 30px var(--shadow-dark);
    display: flex;
    flex-direction: column;
    transition: 0.3s ease;
    z-index: 1001;
}

.cart-panel.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-soft);
}

.cart-header button {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
}

.cart-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-soft);
}

.cart-item img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 14px;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-item-info h4 {
    font-size: 18px;
    font-weight: 600;
}

.cart-item-qty-text {
    font-size: 14px;
    color: var(--text-muted);
}

.cart-item-price {
    color: var(--primary);
    font-weight: 700;
}

.cart-item-controls {
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.cart-item-controls input {
    width: 100%;
    text-align: center;
    background: var(--bg-muted);
    border: none;
    border-radius: 8px;
    padding: 5px;
}

.cart-item-controls .qty-btn {
    width: 30px;
    height: 30px;
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-danger);
    cursor: pointer;
}


.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--border-soft);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 15px;
}

.cart-buy {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    border: none;
    color: var(--bg-white);
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;
}

.cart-buy:hover {
    background: var(--primary-hover);
}


@media (max-width: 1024px) {

    .products {
        padding: 0 18px;
    }

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

    .product-img {
        height: 150px;
    }

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

    .product-desc {
        font-size: 13px;
    }
}



@media (max-width: 768px) {

    .products {
        padding: 0 8px;
    }

    .section-title {
        font-size: 22px;
        margin-bottom: 12px;
    }

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

    .product-card {
        border-radius: 16px;
        box-shadow: 0 4px 10px var(--shadow-dark);
    }

    .product-img {
        height: 95px;
    }

    .product-info {
        padding: 8px;
        gap: 4px;
    }

    .product-name {
        display: none;
    }

    .product-desc {
        font-size: 11px;
        color: var(--text-desc);

        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        overflow: hidden;
    }

    .product-unit {
        font-size: 11px;
        font-weight: 600;
    }

    .product-qty {
        grid-template-columns: 24px 1fr 24px;
        gap: 4px;
        margin: 6px 0;
    }

    .qty-btn {
        width: 22px;
        height: 22px;
        font-size: 12px;
        border-radius: 6px;
    }

    .qty-input {
        height: 26px;
        font-size: 12px;
        border-radius: 20px;
    }

    .product-footer {
        margin-bottom: 4px;
    }

    .product-price-label {
        display: none;
    }

    .product-price {
        font-size: 14px;
        color: var(--primary);
    }

    .add-cart-btn {
        position: absolute;
        right: 8px;
        bottom: 8px;

        width: 28px;
        height: 28px;
        padding: 0;
        font-size: 0;

        display: flex;
        align-items: center;
        justify-content: center;

        border-radius: 50%;
        background: var(--text-dark);
    }

    .add-cart-btn::before {
        content: "🛒";
        font-size: 14px;
    }

    .product-info {
        position: relative;
    }
}

@media (max-width: 480px) {

    .products-list {
        gap: 6px;
    }

    .product-card {
        border-radius: 14px;
    }

    .product-img {
        height: 70px;
    }

    .product-info {
        padding: 6px;
        gap: 2px;
    }

    .product-unit {
        font-size: 10px;
        margin-top: 2px;
    }

    .product-qty {
        margin: 4px 0;
        gap: 4px;
    }

    .qty-btn {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }

    .qty-input {
        height: 22px;
        font-size: 11px;
        border-radius: 14px;
    }

    .product-footer {
        margin-bottom: 2px;
    }

    .product-price {
        font-size: 13px;
    }

    .add-cart-btn {
        width: 22px;
        height: 22px;
    }
}