/**
 * VisionFlow — Login Page Styles
 * Standalone dark theme login with glassmorphism + animated background
 * Version: 1.0.0
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

/* ==========================================================================
   Login Page Body
   ========================================================================== */

.vf-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 20px;
    color: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   Animated Background — Floating Orbs (CSS only)
   ========================================================================== */

.vf-login-page::before,
.vf-login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.vf-login-page::before {
    width: 500px;
    height: 500px;
    background: #6366f1;
    top: -120px;
    right: -100px;
    animation: loginOrb1 12s ease-in-out infinite;
}

.vf-login-page::after {
    width: 400px;
    height: 400px;
    background: #0ea5e9;
    bottom: -80px;
    left: -80px;
    animation: loginOrb2 15s ease-in-out infinite;
}

@keyframes loginOrb1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-60px, 40px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 80px) scale(0.95);
    }
    75% {
        transform: translate(30px, 20px) scale(1.05);
    }
}

@keyframes loginOrb2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(50px, -50px) scale(1.08);
    }
    66% {
        transform: translate(-30px, -30px) scale(0.92);
    }
}

/* Third orb via extra element (or body background layer) */
.vf-login-bg-orb {
    position: absolute;
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: loginOrb3 18s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes loginOrb3 {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-30%, -70%) scale(1.3);
    }
}

/* ==========================================================================
   Login Container
   ========================================================================== */

.vf-login-container {
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Login Card — Glassmorphism
   ========================================================================== */

.vf-login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    animation: loginCardIn 0.6s ease-out;
}

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

/* ==========================================================================
   Logo
   ========================================================================== */

.vf-login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.vf-login-logo img {
    max-width: 180px;
    height: auto;
    margin: 0 auto;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
    animation: logoPulseIn 1s ease-out;
}

@keyframes logoPulseIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    60% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* ==========================================================================
   Title & Subtitle
   ========================================================================== */

.vf-login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 8px;
    line-height: 1.3;
}

.vf-login-subtitle {
    text-align: center;
    color: #94a3b8;
    font-size: 0.9375rem;
    margin-bottom: 32px;
    line-height: 1.5;
}

/* ==========================================================================
   Form
   ========================================================================== */

.vf-login-form {
    width: 100%;
}

/* Form Group */
.vf-login-form-group {
    margin-bottom: 20px;
    position: relative;
}

/* Labels */
.vf-login-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 6px;
}

/* Input Fields */
.vf-login-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
}

.vf-login-input::placeholder {
    color: #64748b;
}

.vf-login-input:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(51, 65, 85, 0.6);
}

.vf-login-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(51, 65, 85, 0.8);
    outline: none;
}

/* Input with error */
.vf-login-input.has-error {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Input Icon */
.vf-login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When label is present, icon needs to shift down */
.vf-login-form-group:has(.vf-login-label) .vf-login-input-icon {
    top: auto;
    bottom: 15px;
    transform: none;
}

.vf-login-input-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vf-login-form-group:focus-within .vf-login-input-icon {
    color: #6366f1;
}

/* Password Toggle */
.vf-login-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #64748b;
    background: none;
    border: none;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    z-index: 2;
}

.vf-login-form-group:has(.vf-login-label) .vf-login-password-toggle {
    top: auto;
    bottom: 11px;
    transform: none;
}

.vf-login-password-toggle:hover {
    color: #f1f5f9;
}

.vf-login-password-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==========================================================================
   Checkbox — Custom Styled
   ========================================================================== */

.vf-login-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #94a3b8;
    user-select: none;
}

.vf-login-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(71, 85, 105, 0.7);
    border-radius: 5px;
    background: rgba(51, 65, 85, 0.5);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.vf-login-checkbox input[type="checkbox"]:hover {
    border-color: #6366f1;
}

.vf-login-checkbox input[type="checkbox"]:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.vf-login-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.vf-login-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.vf-login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.vf-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.vf-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.vf-login-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}

/* Button loading state */
.vf-login-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.vf-login-btn.loading .vf-login-btn-text {
    opacity: 0;
}

.vf-login-btn .vf-login-btn-spinner {
    display: none;
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: loginSpin 0.6s linear infinite;
}

.vf-login-btn.loading .vf-login-btn-spinner {
    display: block;
}

@keyframes loginSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button shimmer effect on hover */
.vf-login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s;
}

.vf-login-btn:hover::before {
    left: 100%;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.vf-login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: loginShake 0.5s ease-in-out;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.vf-login-error-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.vf-login-error-icon svg {
    width: 18px;
    height: 18px;
    stroke: #ef4444;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vf-login-error.hidden {
    display: none;
}

@keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.vf-login-footer {
    text-align: center;
    margin-top: 32px;
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.vf-login-footer a {
    color: #6366f1;
    text-decoration: none;
    transition: color 0.3s;
}

.vf-login-footer a:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* ==========================================================================
   Additional Elements
   ========================================================================== */

/* Separator / Divider */
.vf-login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: #475569;
    font-size: 0.8125rem;
}

.vf-login-divider::before,
.vf-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(71, 85, 105, 0.5);
}

/* Version badge */
.vf-login-version {
    position: fixed;
    bottom: 16px;
    right: 16px;
    font-size: 0.6875rem;
    color: #475569;
    z-index: 2;
}

/* ==========================================================================
   Shake animation for the entire card on error
   ========================================================================== */

.vf-login-card.shake {
    animation: loginShake 0.5s ease-in-out;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .vf-login-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .vf-login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .vf-login-title {
        font-size: 1.25rem;
    }

    .vf-login-subtitle {
        font-size: 0.875rem;
        margin-bottom: 24px;
    }

    .vf-login-logo img {
        max-width: 140px;
    }

    .vf-login-input {
        padding: 12px 12px 12px 40px;
        font-size: 0.9375rem;
    }

    .vf-login-btn {
        padding: 12px;
        font-size: 0.9375rem;
    }

    .vf-login-version {
        display: none;
    }
}

@media (max-width: 360px) {
    .vf-login-card {
        padding: 28px 20px;
    }
}

/* ==========================================================================
   Accessibility — focus-visible for keyboard users
   ========================================================================== */

.vf-login-input:focus-visible {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    outline: none;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .vf-login-page::before,
    .vf-login-page::after,
    .vf-login-bg-orb {
        animation: none;
    }

    .vf-login-card {
        animation: none;
    }

    .vf-login-logo img {
        animation: none;
    }

    .vf-login-error {
        animation: none;
    }

    .vf-login-card.shake {
        animation: none;
    }

    .vf-login-btn::before {
        display: none;
    }

    .vf-login-btn .vf-login-btn-spinner {
        animation-duration: 1s;
    }
}
