:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.35);
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
    --error-border: #fecaca;
    --radius: 14px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    background: #0f172a;
}

.login-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    overflow: hidden;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 45%, #1d4ed8 100%);
}

.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(59, 130, 246, 0.45), transparent),
        radial-gradient(ellipse 60% 50% at 90% 20%, rgba(99, 102, 241, 0.35), transparent);
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    will-change: transform;
    pointer-events: none;
}

.orb--1 {
    width: 320px;
    height: 320px;
    background: #3b82f6;
    top: -80px;
    right: -60px;
    animation: float-a 18s ease-in-out infinite;
}

.orb--2 {
    width: 260px;
    height: 260px;
    background: #6366f1;
    bottom: -40px;
    left: -40px;
    animation: float-b 22s ease-in-out infinite;
}

@keyframes float-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-24px, 20px) scale(1.05); }
}

@keyframes float-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -16px) scale(1.08); }
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 360px;
    animation: fade-up 0.7s var(--ease-out) both;
}

.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    margin-bottom: 1.75rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: fade-up 0.7s var(--ease-out) 0.1s both;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.brand-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    animation: fade-up 0.7s var(--ease-out) 0.15s both;
}

.brand-content .tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
    animation: fade-up 0.7s var(--ease-out) 0.2s both;
}

.brand-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
    animation: fade-up 0.7s var(--ease-out) 0.3s both;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
}

.brand-feature svg { flex-shrink: 0; opacity: 0.9; }

.form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #f8fafc;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 40px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
    animation: card-in 0.65s var(--ease-out) 0.05s both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card-header { margin-bottom: 1.75rem; }

.login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.login-card-header p {
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.alert-error {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    line-height: 1.45;
    animation: shake 0.45s var(--ease-out);
}

.alert-error svg { flex-shrink: 0; margin-top: 1px; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.field { margin-bottom: 1.25rem; }

.field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    pointer-events: none;
    display: flex;
}

.input-wrap input {
    width: 100%;
    padding: 0.8125rem 1rem 0.8125rem 2.75rem;
    font-size: 0.9375rem;
    color: var(--text);
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap input::placeholder { color: #94a3b8; }

.input-wrap input:hover { border-color: #cbd5e1; }

.input-wrap input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrap--password input { padding-right: 2.75rem; }

.toggle-password {
    position: absolute;
    right: 10px;
    padding: 6px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    transition: color 0.15s;
}

.toggle-password:hover { color: var(--text-muted); }

.btn-primary {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled { opacity: 0.75; cursor: wait; }

.btn-primary .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-primary.is-loading .btn-text { visibility: hidden; }

.btn-primary.is-loading .spinner {
    display: block;
    position: absolute;
    inset: 0;
    margin: auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-google {
    width: 100%;
    padding: 0.75rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1f2937;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn-google:hover:not(.btn-google-disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.btn-google svg { flex-shrink: 0; }

.btn-google-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.google-hint {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.google-hint code {
    font-size: 0.6875rem;
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mobile-brand {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.mobile-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.mobile-brand span {
    font-weight: 700;
    font-size: 1.0625rem;
    color: var(--text);
}

@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .brand-panel { display: none; }
    .form-panel {
        padding: 1.25rem;
        min-height: 100dvh;
        align-items: flex-start;
        padding-top: 2rem;
    }
    .mobile-brand { display: flex; }
    .login-card {
        padding: 1.75rem 1.25rem;
        border-radius: 20px;
        box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .orb { display: none; }
}
