/* ============================================================
   FinanceIQ – Login Styles
   ============================================================ */

:root {
    --bg-deep: #080b1a;
    --bg-card: #0f1329;
    --bg-input: #151a36;
    --border: rgba(108, 99, 255, 0.15);
    --border-focus: rgba(108, 99, 255, 0.5);
    --accent: #6c63ff;
    --accent-light: #a78bfa;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --text-primary: #eef0ff;
    --text-secondary: #8a8fb5;
    --text-muted: #5a5f82;
    --income: #10d9a0;
    --expense: #ff5c7c;
    --danger: #f43f5e;
    --success: #10d9a0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.15);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow: hidden;
}

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

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6c63ff, transparent 70%);
    top: -10%;
    left: -5%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-delay: -5s;
    animation-duration: 20s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #10d9a0, transparent 70%);
    top: 40%;
    left: 30%;
    animation-delay: -10s;
    animation-duration: 30s;
    opacity: 0.12;
}

.shape-4 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #38bdf8, transparent 70%);
    top: 20%;
    right: 25%;
    animation-delay: -8s;
    animation-duration: 22s;
    opacity: 0.1;
}

.shape-5 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #ff5c7c, transparent 70%);
    bottom: 10%;
    left: 50%;
    animation-delay: -15s;
    animation-duration: 28s;
    opacity: 0.08;
}

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

/* ── Login Container ── */
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ── Branding Panel (Left) ── */
.login-branding {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), transparent 60%);
    pointer-events: none;
}

.branding-content {
    max-width: 520px;
    position: relative;
    animation: fadeInUp 0.8s ease-out;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 14px;
    color: white;
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4);
}

.brand-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-title {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent), #38bdf8, var(--income));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 48px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(108, 99, 255, 0.06);
    border: 1px solid rgba(108, 99, 255, 0.1);
    border-radius: 14px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(108, 99, 255, 0.1);
    border-color: rgba(108, 99, 255, 0.2);
    transform: translateX(6px);
}

.feature-icon {
    font-size: 1.6rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 99, 255, 0.12);
    border-radius: 12px;
    flex-shrink: 0;
}

.feature-item strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.feature-item p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Form Panel (Right) ── */
.login-form-panel {
    flex: 0 0 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.login-form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 19, 41, 0.65);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    border-left: 1px solid rgba(108, 99, 255, 0.1);
}

.form-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
}

/* ── Auth Card ── */
.auth-card {
    animation: fadeInUp 0.5s ease-out;
}

.auth-card.hidden {
    display: none;
}

.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-header h2 {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* ── Input Groups ── */
.input-group {
    margin-bottom: 22px;
}

.input-group label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

.input-wrapper input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

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

.input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #181d3d;
}

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

.input-wrapper:focus-within .input-icon {
    color: var(--accent);
}

/* ── Toggle Password ── */
.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    z-index: 1;
}

.toggle-password:hover {
    color: var(--accent-light);
}

/* ── Password Strength ── */
.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: all 0.4s ease;
}

.strength-text {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 60px;
    text-align: right;
}

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

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

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

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ── Auth Button ── */
.btn-auth {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.btn-auth::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-auth:hover::before {
    transform: translateX(100%);
}

.btn-auth:hover {
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.45);
    transform: translateY(-2px);
}

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

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Spinner ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── Error / Success ── */
.auth-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    color: var(--danger);
    font-size: 0.85rem;
    animation: shake 0.4s ease;
}

.auth-success {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(16, 217, 160, 0.1);
    border: 1px solid rgba(16, 217, 160, 0.25);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    color: var(--success);
    font-size: 0.85rem;
    animation: fadeInUp 0.3s ease-out;
}

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

/* ── Auth Switch ── */
.auth-switch {
    text-align: center;
    margin-top: 28px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch button {
    background: none;
    border: none;
    color: var(--accent-light);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-switch button:hover {
    color: var(--accent);
}

/* ── Animations ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */
@media (max-width: 960px) {
    .login-container {
        flex-direction: column;
    }

    .login-branding {
        padding: 40px 30px 30px;
        flex: 0 0 auto;
    }

    .brand-title {
        font-size: 1.8rem;
    }

    .brand-features {
        display: none;
    }

    .brand-desc {
        margin-bottom: 0;
        font-size: 0.95rem;
    }

    .login-form-panel {
        flex: 1;
        padding: 30px;
    }

    .login-form-panel::before {
        border-left: none;
        border-top: 1px solid rgba(108, 99, 255, 0.1);
    }

    body {
        overflow: auto;
    }
}

@media (max-width: 480px) {
    .login-branding {
        padding: 30px 20px 20px;
    }

    .brand-logo {
        margin-bottom: 20px;
    }

    .brand-title {
        font-size: 1.5rem;
    }

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

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

    .input-wrapper input {
        padding: 12px 42px 12px 42px;
        font-size: 0.9rem;
    }

    .btn-auth {
        padding: 14px;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .login-form-panel {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}
