/**
 * Public CSS
 *
 * @package CanhcamPromotion_Product_Promotion
 * @since 1.0.0
 */

/* ===== Price Display ===== */
.ccppp-price-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ccppp-regular-price {
    color: #6b7280;
    font-size: 0.9em;
    order: 2;
}

.ccppp-sale-price {
    color: #0a529e;
    font-weight: 600;
    font-size: 1.1em;
    text-decoration: none;
    order: 1;
}

.ccppp-discount-badge {
    display: inline-block;
    background: #0a529e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    order: 3;
}

/* ===== Gift Info ===== */
.ccppp-gift-info {
    margin-top: 20px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #fff 0%, #fdf6f6 100%);
    border: 1px solid #f2d9d9;
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

.ccppp-gift-info.ccppp-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.ccppp-gift-info.ccppp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #dc2626;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ccppp-spin 0.6s linear infinite;
}

@keyframes ccppp-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.ccppp-gift-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ccppp-gift-header::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    /* Icon quà tặng (SVG inline) - bền hơn emoji, không lỗi encoding khi deploy */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 12 20 22 4 22 4 12'/%3E%3Crect x='2' y='7' width='20' height='5'/%3E%3Cline x1='12' y1='22' x2='12' y2='7'/%3E%3Cpath d='M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z'/%3E%3Cpath d='M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z'/%3E%3C/svg%3E");
}

.ccppp-gift-header strong {
    color: #b91c1c;
    font-size: 14px;
    font-weight: 700;
}

.ccppp-gift-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.ccppp-gift-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ccppp-gift-item:hover {
    border-color: #f0b4b4;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.08);
}

/* Discount Gift Icon */
.ccppp-gift-discount .ccppp-gift-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    border: 1px solid #fde047;
    border-radius: 4px;
    flex-shrink: 0;
}

.ccppp-gift-discount .ccppp-gift-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #92400e;
}

.ccppp-gift-discount .ccppp-gift-discount-amount {
    color: #dc2626;
    font-weight: 600;
    font-size: 0.95em;
}

.ccppp-gift-item {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.ccppp-gift-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.ccppp-gift-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ccppp-gift-name {
    color: #171717;
    font-size: 13px;
    font-weight: 500;
}

.ccppp-gift-quantity {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    background: #fdeaea;
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* ===== Gift Badge in Cart/Order ===== */
.ccppp-gift-badge {
    display: inline-block;
    background: #10b981;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
    vertical-align: middle;
}

/* ===== Gift Info in Cart ===== */
.ccppp-cart-gift-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #10b981;
    border-radius: 4px;
}

.ccppp-gift-item-cart {
    font-size: 13px;
    color: #166534;
    line-height: 1.6;
}

.ccppp-gift-label {
    font-weight: 600;
    color: #10b981;
}

.ccppp-gift-name {
    font-weight: 500;
    color: #166534;
}

.ccppp-gift-qty {
    color: #059669;
    font-weight: 600;
}

.ccppp-campaign-name {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* Hide gift items from cart display */
.ccppp-hidden-gift-item {
    display: none !important;
}

/* ===== Gift Radio Button ===== */
.ccppp-gift-radio-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
}

.ccppp-gift-radio {
    margin: 0 !important;
    cursor: pointer;
}

.ccppp-gift-item:has(.ccppp-gift-radio-wrapper) {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ccppp-gift-item:has(.ccppp-gift-radio-wrapper):hover {
    background-color: #f3f4f6;
}

/* ===== Additional Benefits ===== */
.ccppp-additional-benefits {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.ccppp-benefits-header {
    margin-bottom: 12px;
}

.ccppp-benefits-header strong {
    color: #171717;
    font-size: 14px;
}

.ccppp-benefits-content {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
}

.ccppp-benefits-content p {
    margin: 0 0 12px 0;
}

.ccppp-benefits-content p:last-child {
    margin-bottom: 0;
}

.ccppp-benefits-content ul,
.ccppp-benefits-content ol {
    margin: 0 0 12px 0;
    padding-left: 24px;
}

.ccppp-benefits-content li {
    margin-bottom: 6px;
}

.ccppp-benefits-content strong {
    font-weight: 600;
    color: #171717;
}

.ccppp-benefits-content a {
    color: #2563eb;
    text-decoration: none;
}

.ccppp-benefits-content a:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .ccppp-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .ccppp-gift-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

