:root {
    --primary-rgb: 37, 99, 235;
}

[data-theme="dark"] {
    --primary-rgb: 59, 130, 246;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 73px);
    padding: 2rem 1.5rem;
    background-color: var(--bg);
}

.auth-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

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

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

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.auth-subtitle {
    color: var(--muted-text);
    font-size: 1rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-text);
    pointer-events: none;
    font-size: 1rem;
    z-index: 2;
    transition: color 0.2s;
}

.form-input,
.auth-form input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

.form-input:focus,
.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    background: var(--card);
}

.form-input:focus + .input-icon {
    color: var(--primary);
}

.badge-optional {
    font-size: 0.75rem;
    background: var(--bg-secondary);
    color: var(--muted-text);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.btn-submit {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px -1px rgba(var(--primary-rgb), 0.25);
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px -1px rgba(var(--primary-rgb), 0.3);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-passkey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-passkey:hover {
    background: var(--bg-hover);
    border-color: var(--muted-text);
    transform: translateY(-2px);
}

.btn-passkey i {
    font-size: 1.2rem;
    color: var(--primary);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--muted-text);
    margin: 1.5rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider::before { margin-right: 1rem; }
.divider::after { margin-left: 1rem; }

.form-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.auth-switch,
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--muted-text);
}

.auth-switch a,
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.25rem;
}

.auth-switch a:hover,
.auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
        align-items: flex-start; 
        padding-top: 2.5rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
        box-shadow: none;
        border: none;
        background: transparent;
        border-radius: 0;
    }

    .auth-title {
        font-size: 1.75rem;
    }

    .form-input, 
    .auth-form input {
        font-size: 16px;
    }
}