@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #080b11;
    --card-bg: rgba(15, 22, 36, 0.45);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-color: #8b5cf6;
    --secondary-color: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
    --btn-gradient: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --btn-hover-gradient: linear-gradient(135deg, #7c3aed 0%, #0891b2 100%);
    --input-bg: rgba(10, 15, 26, 0.6);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus: rgba(167, 139, 250, 0.2);
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Animated Blobs */
.bg-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float-blob 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background-color: var(--primary-color);
}

.blob-2 {
    bottom: -15%;
    right: -10%;
    width: 55vw;
    height: 55vw;
    background-color: var(--secondary-color);
    animation-delay: -5s;
    animation-duration: 25s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background-color: #ec4899;
    opacity: 0.08;
    animation-delay: -10s;
    animation-duration: 18s;
}

@keyframes float-blob {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(5%, 8%) scale(1.1);
    }

    100% {
        transform: translate(-5%, -5%) scale(0.95);
    }
}

/* Main Container */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glassmorphic Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s, box-shadow 0.3s;
}

    .glass-card:hover {
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.05);
    }

/* Logo and Header */
.brand-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 75px;
    height: 60px;
    border-radius: 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 16px;
}

.brand-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.brand-tagline {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.field-error {
    max-height: 0;
    margin: 0;
    color: #fda4af;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(-4px);
    overflow: hidden;
    transition: max-height 0.2s ease, margin 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

    .field-error.is-visible {
        max-height: 20px;
        margin: 8px 0 0;
        opacity: 1;
        transform: translateY(0);
    }

.form-input[aria-invalid="true"] {
    border-color: rgba(253, 164, 175, 0.8);
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.14);
}

body.light-theme .field-error {
    color: #be123c;
}

.input-container {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: color 0.2s;
}

.form-input.has-password-toggle {
    padding-right: 56px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, transform 0.2s;
}

    .password-toggle:hover,
    .password-toggle:focus-visible,
    .form-input:focus ~ .password-toggle {
        color: var(--primary-color);
    }

    .password-toggle:hover,
    .password-toggle:focus-visible {
        background: rgba(255, 255, 255, 0.05);
        outline: none;
    }

    .password-toggle:active,
    .password-toggle[aria-pressed="true"] {
        transform: translateY(-50%) scale(0.95);
        color: var(--secondary-color);
    }

    .password-toggle .eye-icon {
        width: 19px;
        height: 19px;
    }

    .password-toggle .eye-open-icon {
        display: none;
    }

    .password-toggle[aria-pressed="true"] .eye-closed-icon {
        display: none;
    }

    .password-toggle[aria-pressed="true"] .eye-open-icon {
        display: block;
    }

body.light-theme .password-toggle:hover,
body.light-theme .password-toggle:focus-visible {
    background: rgba(15, 22, 36, 0.06);
}

.form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 14px 16px 14px 48px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    transition: all 0.2s ease-in-out;
}

    .form-input:hover {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .form-input:-webkit-autofill,
    .form-input:-webkit-autofill:hover {
        -webkit-text-fill-color: var(--text-primary);
        caret-color: var(--text-primary);
        -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
        box-shadow: 0 0 0 1000px var(--input-bg) inset;
        border-color: var(--input-border);
        transition: background-color 9999s ease-out, color 9999s ease-out;
    }

        .form-input:-webkit-autofill:focus {
            -webkit-text-fill-color: var(--text-primary);
            caret-color: var(--text-primary);
            -webkit-box-shadow: 0 0 0 1000px rgba(10, 15, 26, 0.8) inset, 0 0 0 4px var(--input-focus);
            box-shadow: 0 0 0 1000px rgba(10, 15, 26, 0.8) inset, 0 0 0 4px var(--input-focus);
            border-color: var(--primary-color);
        }

body.light-theme .form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.95) inset, 0 0 0 4px var(--input-focus);
    box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.95) inset, 0 0 0 4px var(--input-focus);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--input-focus);
    background: rgba(10, 15, 26, 0.8);
}

    .form-input:focus ~ .input-icon {
        color: var(--primary-color);
    }

/* Utilities row */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 13px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
}

    .remember-me input {
        display: none;
    }

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    transition: all 0.2s;
}

.remember-me:hover .custom-checkbox {
    border-color: var(--primary-color);
}

.remember-me input:checked + .custom-checkbox {
    background: var(--btn-gradient);
    border-color: transparent;
}

    .remember-me input:checked + .custom-checkbox::after {
        content: "";
        width: 5px;
        height: 9px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg) translate(-0.5px, -1px);
    }

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

    .forgot-password:hover {
        color: #a78bfa;
        text-decoration: underline;
    }

/* Login Button */
.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--btn-gradient);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

    .btn-login:hover {
        background: var(--btn-hover-gradient);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4), 0 0 15px rgba(6, 182, 212, 0.2);
    }

    .btn-login:active {
        transform: translateY(0);
        box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
    }

/* Footer Links */
.form-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.link-signup {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.2s;
}

    .link-signup:hover {
        color: #a78bfa;
        text-decoration: underline;
    }

/* Responsive constraints */
@media (max-width: 480px) {
    .glass-card {
        padding: 32px 24px;
    }

    .brand-name {
        font-size: 24px;
    }
}

/* Light Theme overrides */
body.light-theme {
    --bg-primary: #f8fafc;
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(226, 232, 240, 0.6) 100%);
    --card-bg: rgba(255, 255, 255, 0.4);
    --card-border: rgba(15, 22, 36, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --input-bg: rgba(255, 255, 255, 0.85);
    --input-border: rgba(15, 22, 36, 0.12);
    --input-focus: rgba(139, 92, 246, 0.08);
}

    body.light-theme .blob {
        opacity: 0.09;
    }

    body.light-theme .logo-container {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    body.light-theme .form-input:focus {
        background: rgba(255, 255, 255, 0.95);
    }

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.light-theme .theme-toggle {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(15, 22, 36, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-toggle:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--primary-color);
}

body.light-theme .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(15, 22, 36, 0.15);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle .sun-icon {
    display: none;
    width: 20px;
    height: 20px;
}

.theme-toggle .moon-icon {
    display: block;
    width: 20px;
    height: 20px;
}

body.light-theme .theme-toggle .sun-icon {
    display: block;
}

body.light-theme .theme-toggle .moon-icon {
    display: none;
}

/* Ensure smooth theme transitions on variables-dependent properties */
.glass-card,
.form-input,
.brand-name,
.brand-tagline,
.form-label,
.logo-container {
    transition: all 0.3s ease;
}

/* Company Logo bottom corner */
.company-logo-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    pointer-events: auto;
}

    .company-logo-container img {
        height: 62px;
        width: auto;
        opacity: 1;
        transition: filter 0.3s ease;
        display: block;
    }

/* In dark theme, we can make the logo blend slightly better by adding a low opacity, or invert if it's too dark */
body:not(.light-theme) .company-logo-container img {
    filter: brightness(1.2) contrast(1.1);
}

/* Particles canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
}
