/**
 * Estilos para produtos de doação - Frontend
 * 
 * @since 1.0.0
 */

/* Oculta preço quando existe campos de doação variável */
.donation-fields ~ * .woocommerce-Price-amount,
.donation-fields + * .woocommerce-Price-amount,
body:has(.donation-fields) .woocommerce-Price-amount {
    display: none !important;
}

/* Container principal dos campos de doação */
.donation-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Botões de valores pré-definidos */
.donation-preset-btn {
    padding: 8px 0px;
    width: fit-content;
    height: 50px;
    display: flex;
    align-items: center;
}

.donation-preset-btn.selected {
    background-color: #007cba;
    color: #fff;
}

/* Container dos botões pré-definidos */
.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.donation-margin-left{
    margin-left: 35px;
}

/* Label do campo de valor */
[for="donation_amount"] {
    margin: 0px;
}

/* === ESTILOS DA BARRA DE PROGRESSO DA DOAÇÃO === */
.donation-progress-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    container-type: inline-size;
}

.donation-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.donation-progress-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.donation-progress-percentage {
    font-size: 14px;
    font-weight: 600;
    color: #28a745;
    background: #e8f5e8;
    padding: 4px 12px;
    border-radius: 20px;
}

.donation-progress-bar {
    width: 100%;
    height: 14px;
    background-color: #e9ecef;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.donation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 7px;
    transition: width 0.6s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    position: relative;
}

.donation-progress-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.donation-current-info,
.donation-goal-info,
.donation-remaining-info {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.donation-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.donation-amount {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.donation-current-info .donation-amount {
    color: #28a745;
}

.donation-remaining-info .donation-amount {
    color: #dc3545;
}

.donation-goal-reached {
    margin-top: 10px;
    padding: 10px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

/* Responsividade */
@media (max-width: 768px) {
    .donation-progress-container {
        padding: 20px;
    }
    
    .donation-progress-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-align: center;
    }
    
    .donation-progress-title {
        font-size: 16px;
    }
    
    .donation-progress-details {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .donation-amount {
        font-size: 15px;
    }
}

/* Responsividade baseada no tamanho do container */
@container (max-width: 460px) {
    .donation-progress-container {
        padding: 20px;
    }
    
    .donation-progress-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-align: center;
    }
    
    .donation-progress-title {
        font-size: 16px;
    }
    
    .donation-progress-details {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .donation-amount {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .donation-progress-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .donation-progress-title {
        font-size: 15px;
    }
    
    .donation-current-info,
    .donation-goal-info,
    .donation-remaining-info {
        padding: 12px;
    }
    
    .donation-amount {
        font-size: 14px;
    }
}

/* Container do campo customizado */
.custom-amount-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* Container interno da moeda e input */
.custom-amount-field > div:first-of-type {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Garantir que a div quantity não quebre linha */
.custom-amount-field .quantity {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

/* Responsividade para tablets */
@media (max-width: 1024px) {
    .single_add_to_cart_button {
        flex: 1 1 auto;
        min-width: 200px;
    }
}

/* Responsividade para celular */
@media (max-width: 768px) {
    .preset-buttons {
        margin-left: 0;
    }
    
    .donation-preset-btn {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .donation-fields {
        gap: 15px;
    }
    
    .custom-amount-field {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .custom-amount-field > div:first-of-type {
        display: flex;
        justify-content: flex-start;
        gap: 10px;
        white-space: nowrap;
        flex-direction: row;
    }
    
    .custom-amount-field .quantity {
        display: inline-flex;
        align-items: center;
        margin: 0;
    }
    
    #donation_amount {
        width: 100%;
        height: 20px;
        text-align: center;
        font-size: 16px;
    }
    
    [for="donation_amount"] {
        text-align: left;
        font-size: 18px;
        margin: 0;
    }
    
    .single_add_to_cart_button {
        width: 100%;
        height: 50px;
    }
}

/* Estilos para estados de erro */
#donation_amount.error {
    border-color: #dc3232;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.8);
    background-color: #ffeaea;
}

.preset-buttons.error {
    outline: 2px solid #dc3232;
    outline-offset: 2px;
    border-radius: 4px;
    background-color: #ffeaea;
    padding: 5px;
}

/* === ESTILOS DO CONTADOR REGRESSIVO === */
.donation-countdown-container {
    background: var(--wp--preset--color--contrast);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: var(--wp--preset--color--contrast);
}

.donation-countdown-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.donation-countdown-timer {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 8px;
    min-width: 80px;
    backdrop-filter: blur(10px);
}

.countdown-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.countdown-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Mensagem de prazo expirado */
.donation-deadline-expired {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.donation-deadline-message {
    font-size: 16px;
    font-weight: 500;
}

/* Mensagem de meta atingida */
.donation-goal-reached-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.donation-goal-reached-message p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* Mensagem de prazo expirado na página do produto */
.donation-deadline-expired-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.donation-deadline-expired-message p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* Responsividade para o contador */
@media (max-width: 768px) {
    .donation-countdown-container {
        padding: 15px;
    }
    
    .donation-countdown-timer {
        gap: 10px;
    }
    
    .countdown-item {
        padding: 10px 15px;
        min-width: 60px;
    }
    
    .countdown-number {
        font-size: 24px;
    }
    
    .countdown-label {
        font-size: 11px;
    }
    
    /* Responsividade para mensagens */
    .donation-goal-reached-message,
    .donation-deadline-expired-message {
        padding: 15px;
        margin: 15px 0;
    }
    
    .donation-goal-reached-message p,
    .donation-deadline-expired-message p {
        font-size: 14px;
    }
}
