/**
 * Estilos para validações de segurança
 */

/* Feedback de validação */
.field-feedback {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    width: 100%;
    transition: all 0.3s ease;
}

.field-feedback.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.field-feedback.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

/* Estados dos campos */
.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

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

/* Indicador de força da senha */
.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.password-strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength-weak .password-strength-fill {
    width: 25%;
    background-color: #dc3545;
}

.password-strength-fair .password-strength-fill {
    width: 50%;
    background-color: #ffc107;
}

.password-strength-good .password-strength-fill {
    width: 75%;
    background-color: #17a2b8;
}

.password-strength-strong .password-strength-fill {
    width: 100%;
    background-color: #28a745;
}

.password-strength-text {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Animações de carregamento */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

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

/* Honeypot - garantir que permaneça oculto */
input[name="website"] {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Alertas de segurança */
.security-alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.security-alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.security-alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.security-alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Rate limit warning */
.rate-limit-warning {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    max-width: 300px;
    padding: 1rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.25rem;
    color: #721c24;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Tooltip para dicas de segurança */
.security-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.security-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
}

.security-tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.security-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsividade */
@media (max-width: 768px) {
    .rate-limit-warning {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .field-feedback {
        font-size: 0.8rem;
    }
    
    .security-tooltip .tooltip-text {
        width: 150px;
        margin-left: -75px;
    }
}

/* Melhorias de acessibilidade */
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Indicadores visuais para campos obrigatórios */
.required-field::after {
    content: ' *';
    color: #dc3545;
    font-weight: bold;
}

/* Estilo para campos desabilitados durante envio */
.form-control:disabled {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}