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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --accent: #a78bfa;
    --surface: #0f0f1a;
    --surface-light: #1a1a2e;
    --surface-card: #16162a;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(148, 163, 184, 0.12);
    --error: #f87171;
    --success: #34d399;
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/*particles*/
.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-particles .particle {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/*login container*/
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(800px, 95vw);
    min-height: 640px;
    background: var(--surface-card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px var(--border),
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 80px -20px var(--primary-glow);
    animation: cardEntry 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/*form*/
.form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 56px;
    background: var(--surface-card);
    position: relative;
}

.form-panel::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

.form-wrapper {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.4s ease-out;
}

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

.name-row {
    display: flex;
    gap: 16px;
}

.name-row .input-group {
    flex: 1;
}

.name-row .input-wrapper input {
    padding-left: 16px;
}

/*header*/
.form-header {
    margin-bottom: 36px;
}

.form-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.form-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/*form inputs*/
.input-group {
    margin-bottom: 22px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-dim);
    transition: color var(--transition);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--surface-light);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.input-wrapper input::placeholder {
    color: var(--text-dim);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: var(--primary-light);
}

.input-wrapper:has(input:focus) .input-icon {
    color: var(--primary-light);
}

/*error*/
.input-group.error .input-wrapper input {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.error-msg {
    display: block;
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 6px;
    min-height: 1.2em;
    transition: var(--transition);
}

/*hide password*/
.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.toggle-password:hover {
    color: var(--text-muted);
}

/*form options*/
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--surface-light);
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-label input:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .custom-checkbox::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.forgot-link:hover {
    color: var(--accent);
}

/*submit*/
.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px -5px var(--primary-glow);
}

.btn-login:hover::before {
    opacity: 1;
}

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

/*loading*/
.btn-loader {
    display: flex;
    gap: 4px;
}

.btn-loader span {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.btn-loader span:nth-child(1) { animation-delay: -0.32s; }
.btn-loader span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/*divider line*/
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 16px;
}

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

.divider span {
    font-size: 0.8rem;
    color: var(--text-dim);
    white-space: nowrap;
}

/*google and microsoft*/
.social-login {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-social:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--text);
    transform: translateY(-1px);
}

/*signup prompt*/
.signup-prompt {
    text-align: center;
    margin-top: 28px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.signup-prompt a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
}

.signup-prompt a:hover {
    color: var(--accent);
}

/*success toast*/
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--surface-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.toast.show {
    transform: translateX(0);
}

/*responsiveness*/
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        min-height: auto;
        max-height: 95vh;
        overflow-y: auto;
    }

    .form-panel {
        padding: 32px 28px;
    }
    
}

@media (max-width: 480px) {
    .login-container {
        border-radius: 20px;
        width: 98vw;
    }

    .form-panel {
        padding: 24px 20px;
    }

    .form-header h2 {
        font-size: 1.4rem;
    }

    .social-login {
        flex-direction: column;
    }
}

/*shake animation*/
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-4px); }
    30%, 70% { transform: translateX(4px); }
}

.input-group.error .input-wrapper {
    animation: shake 0.5s ease-in-out;
}