.quancaowp-block {
    display: block;
    clear: both; /* Đảm bảo không bị dính với các element float khác */
    margin: 20px 0; /* Khoảng cách trên dưới an toàn */
    padding: 0;
    width: 100%;
    max-width: 100%; /* Tránh tràn layout trên mobile */
    box-sizing: border-box;
    overflow: hidden; /* Ẩn phần thừa nếu quảng cáo quá khổ */
}

/* Style cho tiêu đề quảng cáo (như label 'Tài trợ' hoặc 'Quảng cáo') */
.quancaowp-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 5px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.quancaowp-content {
    display: block;
    line-height: normal; /* Reset line-height để tránh ảnh hưởng layout quảng cáo */
}

/* Đảm bảo ảnh/iframe trong quảng cáo responsive */
.quancaowp-content img,
.quancaowp-content iframe,
.quancaowp-content video {
    max-width: 100%;
    height: auto;
    display: block; /* Tránh khoảng trắng thừa dưới ảnh */
    margin: 0 auto; /* Căn giữa nếu nhỏ hơn container */
}

/* Các class căn chỉnh */
.quancaowp-align-center {
    text-align: center;
}
.quancaowp-align-center .quancaowp-product-grid {
    margin-left: auto;
    margin-right: auto;
}

.quancaowp-align-left {
    text-align: left;
}
.quancaowp-align-left .quancaowp-product-grid {
    margin-left: 0;
    margin-right: auto;
}

.quancaowp-align-right {
    text-align: right;
}
.quancaowp-align-right .quancaowp-product-grid {
    margin-left: auto;
    margin-right: 0;
}

/* Product Grid */
.quancaowp-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Product Card Styles */
.quancaowp-product-card {
    display: block;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%; /* Equal height in grid */
    text-align: left; /* Reset text align inside card */
}

.quancaowp-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.quancaowp-card-link {
    display: flex;
    text-decoration: none !important;
    color: inherit !important;
    align-items: stretch;
    flex-direction: column; /* Vertical Layout by default for Grid */
    height: 100%;
}

.quancaowp-product-image {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    padding: 10px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee; /* Bottom border instead of right */
    border-right: none;
}

.quancaowp-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.quancaowp-product-info {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push button to bottom */
}

.quancaowp-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0 !important;
    line-height: 1.4 !important;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none !important;
}

.quancaowp-product-price {
    font-size: 18px;
    color: #d32f2f;
    font-weight: 700;
    margin-bottom: 12px;
    margin-top: auto; /* Push to bottom if title is short */
}

.quancaowp-product-action {
    display: block;
    margin-top: 10px;
    text-align: center;
}

.quancaowp-btn {
    background: #d32f2f;
    color: #fff;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    transition: background 0.2s;
}

.quancaowp-card-link:hover .quancaowp-btn {
    background: #b71c1c;
}

/* Responsive */
@media (max-width: 480px) {
    .quancaowp-product-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
    }
}
