/**
 * TUH Conditional Discounts - Frontend Styles
 * @since 2.1.0
 */

/* ======= Container ======= */
#tuh-discount-preview-container {
    margin-top: 15px;
    margin-bottom: 15px;
}

/* ======= Desconto Aplicado ======= */
.tuh-discount-applied {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #10b981;
    border-radius: 10px;
    margin-bottom: 10px;
    animation: tuhDiscountIn 0.4s ease;
    box-sizing: border-box;
}

@keyframes tuhDiscountIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tuh-discount-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    background: #10b981;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.tuh-discount-icon svg,
.tuh-discount-applied svg {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    min-width: 18px;
    min-height: 18px;
    color: white;
    flex-shrink: 0;
}


.tuh-discount-info {
    flex: 1;
    min-width: 0;
}

.tuh-discount-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #065f46;
}

.tuh-discount-message {
    display: block;
    font-size: 12px;
    color: #047857;
    margin-top: 2px;
}

.tuh-discount-value {
    font-weight: 700;
    font-size: 16px;
    color: #059669;
    white-space: nowrap;
}

/* ======= Desconto Disponível (Hint) ======= */
.tuh-discounts-available {
    margin-top: 10px;
}

.tuh-discount-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 2px dashed #f59e0b;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tuh-discount-hint:hover {
    border-style: solid;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.tuh-hint-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    background: #f59e0b;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.tuh-hint-icon svg,
.tuh-discount-hint svg {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    min-width: 20px;
    min-height: 20px;
    color: white;
    flex-shrink: 0;
}


.tuh-hint-content {
    flex: 1;
    min-width: 0;
}

.tuh-hint-content strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 3px;
}

.tuh-hint-content > span {
    display: block;
    font-size: 13px;
    color: #b45309;
    line-height: 1.4;
}

/* Garantir que preços do WooCommerce fiquem inline */
.tuh-hint-content .woocommerce-Price-amount,
.tuh-hint-content .woocommerce-Price-currencySymbol,
.tuh-hint-content bdi,
.tuh-hint-content > span .woocommerce-Price-amount,
.tuh-hint-content > span bdi,
.tuh-hint-value .woocommerce-Price-amount,
.tuh-hint-value .woocommerce-Price-currencySymbol,
.tuh-hint-value bdi {
    display: inline;
    white-space: nowrap;
}

.tuh-hint-value {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: #d97706;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(217, 119, 6, 0.2);
}

.tuh-hint-value .woocommerce-Price-amount {
    color: #d97706;
    font-weight: 700;
    display: inline;
}

/* ======= Desconto PIX Específico ======= */
.tuh-pix-discount {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #34d399;
    border-radius: 12px;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.tuh-pix-discount::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #10b981, #059669);
}

.tuh-pix-icon {
    width: 40px;
    height: 40px;
    background: #10b981;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tuh-pix-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.tuh-pix-info {
    flex: 1;
}

.tuh-pix-title {
    font-weight: 700;
    font-size: 14px;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tuh-pix-badge {
    background: #10b981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.tuh-pix-message {
    font-size: 12px;
    color: #047857;
    margin-top: 2px;
}

.tuh-pix-values {
    text-align: right;
}

.tuh-pix-original {
    font-size: 12px;
    color: #6b7280;
    text-decoration: line-through;
}

.tuh-pix-final {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

.tuh-pix-savings {
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
}

/* ======= Animação de Pulse ======= */
.tuh-discount-hint.tuh-pulse {
    animation: tuhPulse 2s infinite;
}

@keyframes tuhPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
}

/* ======= Loading State ======= */
.tuh-discount-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #888;
}

.tuh-discount-loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #8C52FF;
    border-radius: 50%;
    animation: tuhSpin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes tuhSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ======= Responsivo ======= */
@media (max-width: 480px) {
    .tuh-discount-applied,
    .tuh-discount-hint,
    .tuh-pix-discount {
        flex-wrap: wrap;
    }

    .tuh-discount-value,
    .tuh-pix-values {
        width: 100%;
        text-align: left;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px dashed rgba(0,0,0,0.1);
    }

    .tuh-pix-values {
        display: flex;
        align-items: center;
        gap: 10px;
    }
}
