:root {
    --bg-gradient-from: #0f172a;
    --bg-gradient-to: #0f1729;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --button-primary: #3b82f6;
    --button-primary-hover: #2563eb;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-focus-border: #3b82f6;
    --input-focus-shadow: rgba(59, 130, 246, 0.1);
    --success-color: #10b981;
    --error-color: #ef4444;
    --transition-speed: 200ms;
}

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

body {
    font-family: "Inter", sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-from), var(--bg-gradient-to));
    min-height: 100vh;
    line-height: 1.5;
    overflow: hidden;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    position: relative;
    z-index: 10;
    animation: slideUp 0.6s ease-out;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(29, 78, 216, 0.1));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.login-card::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.login-card.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.login-card.fade-in {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.company-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.logo-icon {
    color: var(--button-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(29, 78, 216, 0.1));
    padding: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
}

input[type="email"],
input[type="password"],
input[type="text"].password-input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-speed) ease;
}

input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"].password-input::placeholder {
    color: var(--text-muted);
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"].password-input:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    background-color: rgba(255, 255, 255, 0.08);
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: color var(--transition-speed) ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
}

.password-toggle:focus {
    outline: none;
    color: var(--text-primary);
}

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--button-primary), var(--button-primary-hover));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

.login-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
}

.login-button:hover::before {
    left: 100%;
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.login-button:disabled:hover {
    box-shadow: none;
}

.login-button:disabled::before {
    display: none;
}

.login-button.ready {
    background: linear-gradient(135deg, var(--button-primary), var(--button-primary-hover));
    opacity: 1;
}

.button-icon {
    transition: transform var(--transition-speed) ease;
}

.login-button:hover .button-icon {
    transform: translateX(2px);
}

.login-button.loading {
    pointer-events: none;
}

.login-button.loading .button-text,
.login-button.loading .button-icon {
    opacity: 0;
}

.login-button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error messages */
.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
}

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

/* Background elements */
.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.floating-element {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(29, 78, 216, 0.05));
    animation: float 6s ease-in-out infinite;
    filter: blur(1px);
}

.floating-element-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: -10%;
    animation-delay: 0s;
}

.floating-element-2 {
    width: 200px;
    height: 200px;
    top: 60%;
    right: -5%;
    animation-delay: 2s;
}

.floating-element-3 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* TOTP digit inputs */
.totp-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.totp-inputs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.totp-digit {
    width: 3rem;
    height: 3rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all var(--transition-speed) ease;
}

.totp-digit:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    background-color: rgba(255, 255, 255, 0.08);
}

/* MFA Setup styles */
.mfa-setup-card {
    max-width: 480px;
}

.mfa-setup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.qr-code-wrapper {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    display: inline-block;
}

.qr-code-wrapper img {
    display: block;
}

.manual-entry-section {
    text-align: center;
    width: 100%;
}

.manual-entry-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mfa-account-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.secret-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.secret-code {
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    word-break: break-all;
}

.copy-button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--button-primary), var(--button-primary-hover));
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

.copy-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.verify-instruction {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-speed) ease;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Input focus wrapper effect */
.input-wrapper.input-focused {
    transform: scale(1.02);
    transition: transform var(--transition-speed) ease;
}

/* Responsive */
@media (max-width: 480px) {
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem;
    }

    .totp-inputs {
        gap: 0.5rem;
    }

    .totp-digit {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .mfa-setup-card {
        max-width: 100%;
    }

    .secret-display {
        flex-direction: column;
    }
}
