.twofa-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.twofa-modal.show {
    display: flex;
    opacity: 1;
}

.twofa-modal-content {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 
        0 32px 64px rgba(0, 0, 0, 0.4),
        0 16px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.twofa-modal.show .twofa-modal-content {
    transform: scale(1);
}

.twofa-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239, 68, 68, 0.4) 20%, 
        rgba(239, 68, 68, 0.6) 50%, 
        rgba(239, 68, 68, 0.4) 80%, 
        transparent 100%
    );
    border-radius: 20px 20px 0 0;
}

.twofa-header {
    text-align: center;
    margin-bottom: 2rem;
}

.twofa-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.twofa-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.twofa-subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.4;
}

.twofa-form {
    margin-bottom: 1.5rem;
}

.twofa-input-group {
    position: relative;
    margin-bottom: 1rem;
}

.twofa-input {
    width: 100%;
    padding: 1rem;
    background: rgba(30, 30, 30, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.25em;
    transition: all 0.3s ease;
    outline: none;
    backdrop-filter: blur(8px);
}

.twofa-input:focus {
    border-color: #ef4444;
    background: rgba(30, 30, 30, 0.8);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.twofa-input::placeholder {
    color: #64748b;
    font-weight: 400;
    letter-spacing: 0.1em;
}

.twofa-hint {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.twofa-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.twofa-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.twofa-btn-primary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.twofa-btn-primary:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.twofa-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.twofa-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.twofa-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.backup-toggle {
    text-align: center;
    margin-top: 1rem;
}

.backup-link {
    color: #ef4444;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.backup-link:hover {
    color: #dc2626;
}

.backup-form {
    display: none;
}

.backup-form.show {
    display: block;
}

.backup-input {
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.twofa-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    text-align: center;
    animation: errorShake 0.4s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #94a3b8;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .twofa-modal-content {
        margin: 0 1rem;
        padding: 1.5rem;
    }

    .twofa-buttons {
        flex-direction: column;
    }

    .twofa-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .twofa-title {
        font-size: 1.25rem;
    }
}