/**
 * Sistema de Verificação de Segurança
 * Design Profissional v2.0
 */

/* ========================================
   RESET & BASE
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Cores principais */
    --color-primary: #00d4ff;
    --color-primary-dark: #00a8cc;
    --color-primary-light: #4de2ff;
    
    --color-success: #00e676;
    --color-error: #ff3d71;
    --color-warning: #ffaa00;
    
    /* Cores de fundo */
    --color-bg-primary: #0a0e27;
    --color-bg-secondary: #141b3d;
    --color-bg-tertiary: #1a2347;
    
    /* Cores de texto */
    --color-text-primary: #ffffff;
    --color-text-secondary: #a8b2d1;
    --color-text-tertiary: #6b7a99;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.4);
    
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --shadow-glow-strong: 0 0 40px rgba(0, 212, 255, 0.5);
    
    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Bordas */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Espaçamento */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1428 100%);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* ========================================
   PARTÍCULAS DE FUNDO
   ======================================== */

.particles-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 230, 118, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 170, 0, 0.04) 0%, transparent 50%);
    animation: particles-float 20s ease-in-out infinite;
}

@keyframes particles-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.page-wrapper {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: var(--spacing-lg);
    z-index: 1;
}

/* ========================================
   LOADER AVANÇADO
   ======================================== */

.loader-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-primary);
    z-index: 9999;
    opacity: 1;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loader-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.shield-icon {
    width: 80px;
    height: 80px;
    color: var(--color-primary);
    animation: shield-pulse 2s ease-in-out infinite;
    filter: drop-shadow(var(--shadow-glow));
}

@keyframes shield-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.loader-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spinner-rotate 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.spinner-ring:nth-child(2) {
    border-top-color: var(--color-success);
    animation-delay: 0.3s;
    animation-duration: 2s;
}

.spinner-ring:nth-child(3) {
    border-top-color: var(--color-warning);
    animation-delay: 0.6s;
    animation-duration: 2.5s;
}

@keyframes spinner-rotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.loader-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
}

.loader-progress {
    width: 200px;
    height: 4px;
    background: var(--color-bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: 999px;
    animation: progress-fill 3s ease-out forwards;
    box-shadow: 0 0 10px var(--color-primary);
}

@keyframes progress-fill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ========================================
   CARD DE SEGURANÇA
   ======================================== */

.security-card {
    background: linear-gradient(135deg, 
        rgba(20, 27, 61, 0.95) 0%, 
        rgba(26, 35, 71, 0.95) 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: 
        var(--shadow-xl),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.1);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: 
        opacity var(--transition-slow),
        transform var(--transition-slow);
}

.security-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--spacing-md);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-md);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: icon-float 3s ease-in-out infinite;
}

@keyframes icon-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.card-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, #ffffff, var(--color-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-subtitle {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* ========================================
   CAPTCHA
   ======================================== */

.captcha-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.captcha-canvas-container {
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(0, 212, 255, 0.2);
    transition: border-color var(--transition-base);
}

.captcha-canvas-container:hover {
    border-color: rgba(0, 212, 255, 0.4);
}

#captcha-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.captcha-refresh {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

.captcha-refresh:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: rotate(180deg);
}

.captcha-refresh svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   INPUT
   ======================================== */

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.label-required {
    color: var(--color-error);
    font-weight: 700;
}

.input-wrapper {
    position: relative;
}

.captcha-input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 2px;
    background: rgba(10, 14, 39, 0.6);
    border: 2px solid rgba(168, 178, 209, 0.2);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    outline: none;
    transition: all var(--transition-base);
}

.captcha-input::placeholder {
    color: var(--color-text-tertiary);
    letter-spacing: 1px;
    font-weight: 400;
}

.captcha-input:focus {
    border-color: var(--color-primary);
    background: rgba(10, 14, 39, 0.8);
    box-shadow: 
        0 0 0 4px rgba(0, 212, 255, 0.1),
        var(--shadow-glow);
}

.captcha-input.error {
    border-color: var(--color-error);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.input-hint {
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    font-style: italic;
}

/* ========================================
   BOTÃO
   ======================================== */

.btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-base);
    outline: none;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: 
        var(--shadow-md),
        var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        var(--shadow-lg),
        var(--shadow-glow-strong);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-icon {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base);
}

.btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ========================================
   FOOTER
   ======================================== */

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(168, 178, 209, 0.1);
}

.security-badge {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-text-tertiary);
}

.security-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--color-primary);
}

/* ========================================
   TOAST DE NOTIFICAÇÃO
   ======================================== */

.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    max-width: 400px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    opacity: 0;
    transform: translateX(120%);
    transition: all var(--transition-base);
    z-index: 10000;
}

.toast-container.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon.success {
    color: var(--color-success);
}

.toast-icon.error {
    color: var(--color-error);
}

.toast-icon.warning {
    color: var(--color-warning);
}

.toast-message {
    flex: 1;
}

.toast-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text-primary);
}

.toast-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.toast-close {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

.toast-progress {
    height: 3px;
    background: var(--color-primary);
    transform-origin: left;
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}

/* ========================================
   UTILITÁRIOS
   ======================================== */

.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

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

@media (max-width: 640px) {
    .page-wrapper {
        padding: var(--spacing-md);
    }

    .security-card {
        padding: var(--spacing-lg);
    }

    .card-title {
        font-size: 1.5rem;
    }

    .card-subtitle {
        font-size: 0.875rem;
    }

    .toast-container {
        top: var(--spacing-md);
        right: var(--spacing-md);
        left: var(--spacing-md);
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}