/* ===================================================================
   FORM STYLES - NEXT LEVEL LANDING PAGE
   Estados visuais, validação e feedback do usuário
   ================================================================= */

/* Estados de validação dos campos */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: #dc3545 !important;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.4) !important;
    background: rgba(220, 53, 69, 0.1) !important;
    animation: shakeError 0.5s ease-in-out;
}

.form-group.has-success input,
.form-group.has-success textarea,
.form-group.has-success select {
    border-color: #07FB04 !important;
    box-shadow: 0 0 15px rgba(7, 251, 4, 0.4) !important;
    background: rgba(7, 251, 4, 0.1) !important;
}

/* Mensagens de erro */
.error-message {
    color: #dc3545 !important;
    font-size: 0.8rem !important;
    margin-top: 0.5rem !important;
    display: block !important;
    animation: slideInError 0.3s ease !important;
    font-weight: 500;
    text-align: left;
    line-height: 1.4;
    padding-left: 20px;
    position: relative;
}

.error-message::before {
    content: '⚠️';
    position: absolute;
    left: 0;
    top: 0;
}

/* Animações */
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes slideInError {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados dos botões */
.cta-primary.loading {
    opacity: 0.8 !important;
    pointer-events: none !important;
    position: relative !important;
    cursor: not-allowed !important;
}

.cta-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

.cta-primary.success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.4) !important;
    animation: successPulse 0.6s ease;
}

.cta-primary.error {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.4) !important;
    animation: errorShake 0.6s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    font-weight: 600;
    max-width: 400px;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    border-left: 4px solid #155724;
}

.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    border-left: 4px solid #721c24;
}

.toast-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: #212529 !important;
    border-left: 4px solid #856404;
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
    border-left: 4px solid #0c5460;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    animation: iconBounce 0.6s ease;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: currentColor;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Form Loading State */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: inherit;
    z-index: 10;
    backdrop-filter: blur(1px);
}

/* Validação em tempo real - efeitos visuais */
input:focus.error,
textarea:focus.error,
select:focus.error {
    animation: focusErrorPulse 1s ease infinite;
}

input:focus.success,
textarea:focus.success,
select:focus.success {
    animation: focusSuccessPulse 2s ease infinite;
}

@keyframes focusErrorPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 25px rgba(220, 53, 69, 0.6); }
}

@keyframes focusSuccessPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(7, 251, 4, 0.4); }
    50% { box-shadow: 0 0 25px rgba(7, 251, 4, 0.6); }
}

/* Indicadores de progresso */
.form-progress {
    position: relative;
    margin-bottom: 1rem;
}

.form-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #07FB04 0%, #05c503 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Melhorias de acessibilidade */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus aprimorado para acessibilidade */
.cta-primary:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(7, 251, 4, 0.5);
    outline-offset: 2px;
}

/* Estados hover aprimorados */
.cta-primary:not(.loading):not(.success):not(.error):hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(7, 251, 4, 0.4);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: rgba(7, 251, 4, 0.5);
    transition: all 0.3s ease;
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .toast-notification {
        left: 10px;
        right: 10px;
        transform: translateY(-100%);
        max-width: none;
        min-width: auto;
    }
    
    .toast-notification.show {
        transform: translateY(0);
    }
    
    .error-message {
        font-size: 0.75rem;
        padding-left: 15px;
    }
    
    .toast-message {
        font-size: 0.9rem;
    }
    
    .toast-icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .toast-notification {
        padding: 12px 16px;
        border-radius: 8px;
    }
    
    .error-message {
        margin-top: 0.3rem;
    }
    
    .cta-primary.loading::after {
        width: 16px;
        height: 16px;
        margin: -8px 0 0 -8px;
    }
}

/* Temas de alto contraste */
@media (prefers-contrast: high) {
    .toast-notification {
        border: 2px solid currentColor;
    }
    
    .error-message {
        font-weight: 700;
    }
    
    .form-group.has-error input,
    .form-group.has-error textarea,
    .form-group.has-error select {
        border-width: 3px;
    }
    
    .form-group.has-success input,
    .form-group.has-success textarea,
    .form-group.has-success select {
        border-width: 3px;
    }
}

/* Redução de movimento para acessibilidade */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .toast-notification {
        transition: none;
    }
    
    .cta-primary:hover {
        transform: none;
    }
}

/* Classes utilitárias para JavaScript */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-out {
    animation: fadeOut 0.5s ease;
}

.scale-in {
    animation: scaleIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}