/**
 * ESTILOS DO INBEC CAPTCHA WIDGET
 * ====================================
 * Estilos modernos e responsivos para o widget de captcha.
 * Design inspirado no Cloudflare Turnstile.
 */

/* Container principal do widget */
.captcha-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 300px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.captcha-widget:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Área de conteúdo */
.captcha-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Wrapper do checkbox */
.captcha-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Esconde o checkbox nativo */
.captcha-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Label customizado */
.captcha-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #333;
}

/* Checkmark customizado */
.captcha-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid #d0d0d0;
    border-radius: 3px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.captcha-checkmark svg {
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

/* Estado hover */
.captcha-label:hover .captcha-checkmark {
    border-color: #4a90e2;
    background: #f0f7ff;
}

/* Estado checked */
.captcha-checkbox:checked ~ .captcha-label .captcha-checkmark {
    background: #4a90e2;
    border-color: #4a90e2;
}

.captcha-checkbox:checked ~ .captcha-label .captcha-checkmark svg {
    opacity: 1;
    transform: scale(1);
}

/* Estado focus (acessibilidade) */
.captcha-checkbox:focus ~ .captcha-label .captcha-checkmark {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Texto do checkbox */
.captcha-text {
    font-weight: 500;
}

/* Área de status */
.captcha-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

/* Loading spinner */
.captcha-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a90e2;
    border-radius: 50%;
    animation: captcha-spin 0.8s linear infinite;
}

@keyframes captcha-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success indicator */
.captcha-success {
    color: #28a745;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Error indicator */
.captcha-error {
    color: #dc3545;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* Campo honeypot (deve estar escondido) */
.captcha-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Branding */
.captcha-branding {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.captcha-branding span {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsividade para telas pequenas */
@media (max-width: 400px) {
    .captcha-widget {
        max-width: 100%;
    }
    
    .captcha-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .captcha-status {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Tema escuro (opcional) -> Altera para escuro quando o tema do sistema do usuário é escuro */
/* @media (prefers-color-scheme: dark) {
    .captcha-widget {
        background: #2c2c2c;
        border-color: #444;
    }
    
    .captcha-label {
        color: #e0e0e0;
    }
    
    .captcha-checkmark {
        background: #3a3a3a;
        border-color: #555;
    }
    
    .captcha-label:hover .captcha-checkmark {
        background: #444;
        border-color: #4a90e2;
    }
    
    .captcha-branding span {
        color: #666;
    }
} */

/* Estado desabilitado */
.captcha-widget.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Animação de entrada */
.captcha-widget {
    animation: captcha-fadeIn 0.3s ease;
}

@keyframes captcha-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estado de erro do widget inteiro */
.captcha-widget.has-error {
    border-color: #dc3545;
    animation: captcha-shake 0.5s ease;
}

@keyframes captcha-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Customização via data attributes */
.captcha-captcha[data-theme="compact"] .captcha-widget {
    padding: 12px;
    max-width: 260px;
}

.captcha-captcha[data-theme="compact"] .captcha-branding {
    display: none;
}

/* Print styles */
@media print {
    .captcha-widget {
        display: none;
    }
}
/* ===== ESTILOS ADICIONAIS PARA VALIDAÇÃO HTML5 ===== */

/* Mensagem de validação customizada */
.captcha-validation-message {
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
    display: none;
}

.captcha-validation-message.show {
    display: block;
    animation: captcha-fadeIn 0.3s ease;
}

/* Mensagem de erro do servidor (Blade) */
.captcha-server-error {
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
    padding: 0.5rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    animation: captcha-fadeIn 0.3s ease;
}

/* Container de erro dinâmico (AJAX) */
#captcha-error-message {
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
    padding: 0.5rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* ===== ESTILOS PARA ESTADO DE LOADING DO BOTÃO ===== */

/* Botão em estado de loading */
button[type="submit"]:disabled,
input[type="submit"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    position: relative;
}

/* Spinner dentro do botão */
.spinner-border-sm {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.mr-2 {
    margin-right: 0.5rem;
}

/* ===== ESTILOS PARA ALERTAS DE ERRO DO FORMULÁRIO ===== */

/* Container de erro global do formulário */
#form-errors {
    margin-bottom: 1rem;
}

#form-errors ul {
    padding-left: 1.5rem;
    margin-bottom: 0;
}

#form-errors li {
    margin-bottom: 0.25rem;
}

/* Campos com erro (Bootstrap-like) */
.is-invalid {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.invalid-feedback.d-block {
    display: block;
}

/* ===== MELHORIAS DE ACESSIBILIDADE ===== */

/* Foco visível para acessibilidade */
.captcha-widget:focus-within {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Indicador de required */
.captcha-validation-field:required ~ .captcha-widget::after {
    content: none; /* Não mostra asterisco já que é visual apenas */
}

/* ===== RESPONSIVIDADE ADICIONAL ===== */

@media (max-width: 576px) {
    .captcha-validation-message,
    .captcha-server-error,
    #captcha-error-message {
        font-size: 0.75rem;
        padding: 0.375rem;
    }
    
    #form-errors {
        font-size: 0.875rem;
    }
}