/* Custom Properties & Design Tokens */
:root {
    --bg-primary: #080710;
    --card-bg: rgba(8, 7, 16, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-glow: rgba(99, 102, 241, 0.15);

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-violet: #8b5cf6;
    --accent-pink: #ec4899;
    --success: #10b981;
    --error: #ef4444;

    --gradient-primary: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-indigo) 50%, var(--accent-violet) 100%);
    --gradient-overlay: linear-gradient(135deg, rgba(6, 182, 212, 0.9) 0%, rgba(99, 102, 241, 0.9) 50%, rgba(139, 92, 246, 0.9) 100%);

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --ease-spring: cubic-bezier(0.68, -0.6, 0.32, 1.6);
    --ease-smooth: cubic-bezier(0.76, 0, 0.24, 1);
    --transition-speed: 0.6s;
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background Particle Canvas */
#canvas-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

/* Ambient Glow Blobs */
.ambient-glow {
    position: absolute;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    z-index: 2;
    pointer-events: none;
    animation: blobFloat 25s infinite alternate ease-in-out;
}

.glow-1 {
    background: radial-gradient(circle, var(--accent-cyan) 0%, rgba(6, 182, 212, 0) 70%);
    top: -10%;
    left: -10%;
}

.glow-2 {
    background: radial-gradient(circle, var(--accent-violet) 0%, rgba(139, 92, 246, 0) 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(8%, 12%) scale(1.1) rotate(120deg);
    }

    66% {
        transform: translate(-10%, -8%) scale(0.9) rotate(240deg);
    }

    100% {
        transform: translate(0, 0) scale(1) rotate(360deg);
    }
}

/* Main Container & Card Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    width: 850px;
    height: 600px;
    border-radius: 28px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.4),
        0 0 80px var(--card-glow);
    display: flex;
    overflow: hidden;
    position: relative;
    transition: transform 0.5s ease;
}

.auth-card:hover {
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(99, 102, 241, 0.25);
}

/* Forms Side Container */
.forms-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    z-index: 5;
    transition: transform var(--transition-speed) var(--ease-smooth);
}

/* Individual Form Panels */
.auth-form {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 45px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition:
        opacity var(--transition-speed) var(--ease-smooth),
        transform var(--transition-speed) var(--ease-smooth);
}

.auth-form.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Form Switching States (Desktop) */
.auth-card.right-panel-active .forms-container {
    transform: translateX(100%);
}

.auth-card.right-panel-active .sign-in-form {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.auth-card.right-panel-active .sign-up-form {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Header & Typography */
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gradient-primary);
    color: var(--text-primary);
}

.brand-logo i {
    width: 20px;
    height: 20px;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Input Fields & Floating Labels */
.inputs-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 25px 0 15px 0;
}

.input-group {
    position: relative;
    width: 100%;
}

.input-group input {
    width: 100%;
    padding: 20px 16px 8px 42px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

.input-group input:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-indigo);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-group input:focus~.input-icon {
    color: var(--accent-indigo);
}

.input-group label {
    position: absolute;
    left: 42px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.95rem;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: left top;
}

/* Floating Animation triggered by input value/focus */
.input-group input:focus~label,
.input-group input:not(:placeholder-shown)~label {
    top: 8px;
    transform: translateY(0) scale(0.75);
    color: var(--accent-cyan);
}

/* Password View Toggles */
.btn-toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

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

.btn-toggle-password i {
    width: 18px;
    height: 18px;
}

.hidden {
    display: none !important;
}

/* Password Strength Meter */
.strength-meter {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.strength-bar {
    height: 4px;
    width: 0%;
    border-radius: 2px;
    background: var(--text-muted);
    transition: width 0.4s ease, background-color 0.4s ease;
}

.strength-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
    transition: color 0.3s ease;
}

/* Validation styling */
.validation-message {
    font-size: 0.72rem;
    color: var(--error);
    margin-top: 4px;
    display: none;
    text-align: left;
    padding-left: 4px;
    animation: slideDown 0.2s forwards ease;
}

.input-group.invalid input {
    border-color: var(--error) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15) !important;
}

.input-group.invalid .validation-message {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Checkbox & Actions Row */
.form-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
    padding-left: 28px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 18px;
    width: 18px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.checkbox-container:hover input~.checkmark {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.08);
}

.checkbox-container input:checked~.checkmark {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.2s;
}

.checkbox-label a:hover {
    color: var(--accent-indigo);
    text-decoration: underline;
}

.btn-forgot-password {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    outline: none;
}

.btn-forgot-password:hover {
    color: var(--accent-indigo);
    text-decoration: underline;
}

/* Submit Button & Interactive Loading States */
.btn-submit {
    position: relative;
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition:
        transform 0.2s ease,
        box-shadow 0.3s ease,
        background 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px rgba(99, 102, 241, 0.4),
        0 0 15px rgba(6, 182, 212, 0.3);
}

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

/* Button Loading & Success Overlay */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.success-icon {
    width: 22px;
    height: 22px;
    color: #ffffff;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.3) rotate(-15deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.btn-submit.loading {
    background: var(--accent-indigo);
    pointer-events: none;
}

.btn-submit.success {
    background: var(--success);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    pointer-events: none;
}

/* Separator Line */
.separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 15px 0;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.separator:not(:empty)::before {
    margin-right: .5em;
}

.separator:not(:empty)::after {
    margin-left: .5em;
}

/* Social Buttons Grid */
.social-login {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-social {
    flex: 1;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.btn-social svg {
    display: block;
}

.btn-social.google:hover {
    border-color: rgba(234, 67, 53, 0.3);
    box-shadow: 0 5px 15px rgba(234, 67, 53, 0.15);
}

.btn-social.github:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.15);
}

.btn-social.apple:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.15);
}

/* Sliding Side Overlay Panel */
.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform var(--transition-speed) var(--ease-smooth);
    z-index: 100;
}

.auth-card.right-panel-active .overlay-container {
    transform: translateX(-100%);
}

.overlay {
    background: var(--gradient-overlay);
    background-size: 200% 200%;
    color: var(--text-primary);
    position: relative;
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform var(--transition-speed) var(--ease-smooth);
    animation: gradientShift 15s infinite alternate ease-in-out;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.auth-card.right-panel-active .overlay {
    transform: translateX(50%);
}

.overlay-panel {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 50px;
    text-align: center;
    top: 0;
    height: 100%;
    width: 50%;
    transform: translateX(0);
    transition: transform var(--transition-speed) var(--ease-smooth);
}

.overlay-left {
    transform: translateX(-20%);
}

.auth-card.right-panel-active .overlay-left {
    transform: translateX(0);
}

.overlay-right {
    right: 0;
    transform: translateX(0);
}

.auth-card.right-panel-active .overlay-right {
    transform: translateX(20%);
}

.overlay-panel h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

.overlay-panel p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.85);
}

.btn-ghost {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 35px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    transform: scale(1.03);
}

.btn-ghost:active {
    transform: scale(0.98);
}

/* Forgot Password Slide-up Drawer */
.forgot-drawer {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 7, 16, 0.96);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 150;
    border-radius: 28px;
    transition: bottom 0.5s cubic-bezier(0.76, 0, 0.24, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.auth-card.forgot-active .forgot-drawer {
    bottom: 0;
}

.drawer-handle {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.drawer-handle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-drawer-close {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-drawer-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: scale(1.05);
}

.forgot-form {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s ease 0.2s;
}

.auth-card.forgot-active .forgot-form {
    transform: translateY(0);
    opacity: 1;
}

.forgot-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px auto;
}

.forgot-icon-wrap i {
    width: 28px;
    height: 28px;
}

/* Floating Toast Notification Styling */
.toast-wrapper {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: rgba(15, 15, 25, 0.85);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.toast.info .toast-icon {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Responsive Design & Mobile Optimization
   ========================================================================== */

@media (max-width: 868px) {
    .auth-card {
        width: 100%;
        max-width: 420px;
        height: auto;
        min-height: 580px;
        flex-direction: column;
        border-radius: 24px;
    }

    /* Overlay goes off the screen or acts as simple bottom switcher */
    .overlay-container {
        display: none;
        /* Hide overlay panel on mobile for cleaner UX */
    }

    .forms-container {
        position: relative;
        width: 100%;
        height: auto;
    }

    .auth-form {
        position: relative;
        opacity: 0;
        pointer-events: none;
        display: none;
        padding: 35px 30px;
        height: auto;
        transform: none;
        transition: opacity 0.4s ease;
    }

    .auth-form.active {
        opacity: 1;
        pointer-events: auto;
        display: flex;
        transform: none;
    }

    /* Modify desktop form translation triggers */
    .auth-card.right-panel-active .forms-container {
        transform: none;
    }

    .auth-card.right-panel-active .sign-in-form {
        opacity: 0;
        pointer-events: none;
        display: none;
    }

    .auth-card.right-panel-active .sign-up-form {
        opacity: 1;
        pointer-events: auto;
        display: flex;
        transform: none;
    }

    /* Show switch anchors instead of overlay buttons on mobile */
    .form-actions-row {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .btn-forgot-password {
        align-self: flex-end;
        margin-top: -30px;
        /* Offset the checkbox height to keep on same logical row if space permits */
    }

    /* Let's inject a mobile switch link inside forms */
    .mobile-switch-prompt {
        display: block !important;
        text-align: center;
        margin-top: 20px;
        font-size: 0.88rem;
        color: var(--text-secondary);
    }

    .mobile-switch-link {
        color: var(--accent-cyan);
        text-decoration: none;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-switch-link:hover {
        color: var(--accent-indigo);
    }
}

/* Helper for Switch link default hidden on desktop */
.mobile-switch-prompt {
    display: none;
}