/**
 * Estilos para o C6 Bank Checkout
 */

/* Container principal */
#c6-bank-payment-form {
    position: relative;
    margin: 20px 0;
}

#c6-bank-payment-form.c6-loading {
    opacity: 0.6;
    pointer-events: none;
}

#c6-bank-payment-form.c6-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: c6-spin 1s linear infinite;
}

@keyframes c6-spin {
    to { transform: rotate(360deg); }
}

/* Seletor de método de pagamento */
.c6-payment-method-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.c6-payment-method-selector h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.c6-payment-method {
    display: inline-block;
    margin: 0 15px 10px 0;
    padding: 10px 15px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.c6-payment-method:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.c6-payment-method input[type="radio"] {
    margin-right: 8px;
}

.c6-payment-method input[type="radio"]:checked + span {
    font-weight: 600;
    color: #007cba;
}

.c6-payment-method:has(input:checked) {
    border-color: #007cba;
    background: #f0f8ff;
}

/* Campos de pagamento */
.c6-payment-fields {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Cartões salvos */
.c6-saved-cards {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.c6-saved-cards h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.c6-saved-card {
    display: block;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.c6-saved-card:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.c6-saved-card input[type="radio"] {
    margin-right: 10px;
}

.c6-saved-card:has(input:checked) {
    border-color: #007cba;
    background: #f0f8ff;
}

/* Campos do cartão */
#c6-new-card-fields .form-row {
    margin-bottom: 15px;
}

#c6-new-card-fields label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

#c6-new-card-fields input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#c6-new-card-fields input[type="text"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Validação de campos */
.c6-field-valid {
    border-color: #28a745 !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%2328a745" viewBox="0 0 16 16"><path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.c6-field-invalid {
    border-color: #dc3545 !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23dc3545" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.c6-field-error {
    display: block;
    margin-top: 5px;
    color: #dc3545;
    font-size: 12px;
    font-weight: 500;
}

/* Bandeiras de cartão */
#c6_card_number {
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 32px auto;
    padding-right: 50px;
}

#c6_card_number.visa {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"><rect width="32" height="20" rx="4" fill="%23ffffff" stroke="%23ddd"/><text x="16" y="14" text-anchor="middle" font-family="Arial" font-size="8" font-weight="bold" fill="%231a1f71">VISA</text></svg>');
}

#c6_card_number.mastercard {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"><rect width="32" height="20" rx="4" fill="%23ffffff" stroke="%23ddd"/><circle cx="12" cy="10" r="6" fill="%23eb001b"/><circle cx="20" cy="10" r="6" fill="%23f79e1b"/></svg>');
}

#c6_card_number.amex {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"><rect width="32" height="20" rx="4" fill="%23006fcf"/><text x="16" y="14" text-anchor="middle" font-family="Arial" font-size="6" font-weight="bold" fill="white">AMEX</text></svg>');
}

#c6_card_number.elo {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"><rect width="32" height="20" rx="4" fill="%23ffffff" stroke="%23ddd"/><text x="16" y="14" text-anchor="middle" font-family="Arial" font-size="8" font-weight="bold" fill="%23000">ELO</text></svg>');
}

/* Campo de parcelas */
#c6-installments-field select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background: #fff;
    cursor: pointer;
}

#c6-installments-field select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Checkbox para salvar cartão */
.woocommerce-form__label-for-checkbox {
    display: flex !important;
    align-items: center;
    cursor: pointer;
}

.woocommerce-form__label-for-checkbox input[type="checkbox"] {
    margin-right: 10px !important;
    margin-top: 0 !important;
}

/* PIX */
#c6-pix-fields {
    text-align: center;
    padding: 30px 20px;
}

#c6-pix-fields p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .c6-payment-method {
        display: block;
        margin: 0 0 10px 0;
        text-align: center;
    }
    
    .form-row-first,
    .form-row-last {
        width: 100% !important;
        margin-right: 0 !important;
    }
    
    #c6_card_number {
        background-size: 28px auto;
        padding-right: 40px;
    }
}

/* Estados de loading específicos */
.c6-payment-method.loading {
    opacity: 0.6;
    pointer-events: none;
}

.c6-installments-loading {
    position: relative;
}

.c6-installments-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 30px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #ccc;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: c6-spin 1s linear infinite;
}

/* Melhorias de acessibilidade */
.c6-payment-method:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.c6-saved-card:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Animações suaves */
.c6-payment-fields {
    animation: c6-fade-in 0.3s ease-in-out;
}

@keyframes c6-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para o admin */
.c6-bank-admin-section {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.c6-bank-admin-section h3 {
    margin-top: 0;
    color: #333;
}

.c6-test-connection {
    margin-top: 10px;
}

.c6-test-connection button {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.c6-test-connection button:hover {
    background: #005a87;
}

.c6-test-result {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

.c6-test-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.c6-test-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

