/* VisaPrep AI - Login Page - Material Design 3 */

:root {
    --md-sys-color-primary: #6750a4;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #eaddff;
    --md-sys-color-on-primary-container: #21005d;
    --md-sys-color-secondary: #625b71;
    --md-sys-color-surface: #fef7ff;
    --md-sys-color-on-surface: #1c1b1f;
    --md-sys-color-on-surface-variant: #49454f;
    --md-sys-color-outline: #79747e;
    --md-sys-color-error: #b3261e;
    --md-sys-color-surface-container: #f3edf7;
    --md-elevation-1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    --md-elevation-3: 0 10px 20px rgba(0,0,0,.12), 0 6px 6px rgba(0,0,0,.1);
    --md-shape-corner-large: 28px;
    --md-shape-corner-medium: 16px;
    --md-shape-corner-small: 8px;
}

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

body.login-page {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    overflow: hidden;
}

/* Animated Background */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 30%, #4a2c7a 60%, #6750a4 100%);
    overflow: hidden;
}

.login-bg__shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.login-bg__shape--1 {
    width: 500px;
    height: 500px;
    background: #9c7cf4;
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.login-bg__shape--2 {
    width: 400px;
    height: 400px;
    background: #d0bcff;
    bottom: -15%;
    right: -5%;
    animation-delay: -7s;
}

.login-bg__shape--3 {
    width: 300px;
    height: 300px;
    background: #4f378b;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

.login-bg__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 30s linear infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* Login Container */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    animation: slideUp 0.6s ease-out;
}

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

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--md-shape-corner-large);
    box-shadow: var(--md-elevation-3);
    padding: 2.5rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.login-brand__icon {
    width: 64px;
    height: 64px;
    background: var(--md-sys-color-primary-container);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-primary);
}

.login-brand__icon .material-symbols-outlined {
    font-size: 36px;
}

.login-brand__text h1 {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    letter-spacing: -0.5px;
}

.login-brand__text p {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 0.25rem;
}

/* Material Fields */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.md-field {
    position: relative;
    display: flex;
    align-items: center;
}

.md-field__icon {
    position: absolute;
    left: 12px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 20px;
    z-index: 1;
    pointer-events: none;
    transition: color 0.2s;
}

.md-field__input {
    width: 100%;
    padding: 1rem 2.75rem 1rem 2.75rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-small);
    font-family: inherit;
    font-size: 1rem;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.md-field__input:focus {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.md-field__input:focus ~ .md-field__icon,
.md-field__input:not(:placeholder-shown) ~ .md-field__icon {
    color: var(--md-sys-color-primary);
}

.md-field__label {
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    padding: 0 4px;
}

.md-field__input:focus ~ .md-field__label,
.md-field__input:not(:placeholder-shown) ~ .md-field__label {
    top: 0;
    font-size: 0.75rem;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container);
}

.md-field__toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    overflow: hidden;
}

.md-field__toggle:hover {
    background: rgba(103, 80, 164, 0.08);
}

.md-field__toggle .material-symbols-outlined {
    font-size: 20px;
}

/* Checkbox */
.login-form__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.25rem 0;
}

.md-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.md-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.md-checkbox__box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.md-checkbox__box .material-symbols-outlined {
    font-size: 16px;
    color: var(--md-sys-color-on-primary);
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.md-checkbox input:checked ~ .md-checkbox__box {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.md-checkbox input:checked ~ .md-checkbox__box .material-symbols-outlined {
    opacity: 1;
    transform: scale(1);
}

.md-checkbox__label {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.login-form__forgot {
    font-size: 0.875rem;
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.login-form__forgot:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Button */
.md-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s, background 0.2s;
}

.md-btn--filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-elevation-1);
}

.md-btn--filled:hover {
    box-shadow: 0 4px 8px rgba(103, 80, 164, 0.4);
}

.md-btn--filled:active {
    box-shadow: none;
}

.md-btn--block {
    width: 100%;
    margin-top: 0.5rem;
}

.md-btn--loading .md-btn__text {
    visibility: hidden;
}

.md-btn--loading .md-btn__loader {
    display: flex !important;
}

.md-btn__loader {
    position: absolute;
    display: none;
    align-items: center;
    justify-content: center;
}

.md-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}

.login-card__footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.login-card__footer p {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.login-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: var(--md-shape-corner-small);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.login-alert--error {
    background: rgba(179, 38, 30, 0.1);
    color: #b3261e;
    border: 1px solid rgba(179, 38, 30, 0.25);
}

.login-alert .material-symbols-outlined {
    font-size: 20px;
}

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

    .login-form__options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}
