/* FNZ Mobiles - Premium Login Page */
/* Next-Level Glassmorphism Design */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --fnz-primary: #6366f1;
    --fnz-primary-dark: #4f46e5;
    --fnz-primary-light: #818cf8;
    --fnz-accent: #06b6d4;
    --fnz-success: #10b981;
    --fnz-error: #ef4444;
    --fnz-warning: #f59e0b;
    --fnz-text-primary: #1e293b;
    --fnz-text-secondary: #64748b;
    --fnz-text-muted: #94a3b8;
    --fnz-bg-glass: rgba(255, 255, 255, 0.85);
    --fnz-border-glass: rgba(255, 255, 255, 0.4);
    --fnz-shadow-soft: 0 8px 32px rgba(99, 102, 241, 0.15);
    --fnz-shadow-glow: 0 0 60px rgba(99, 102, 241, 0.3);
}

body.login-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6B8DD6 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated Background Elements */
body.login-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.2) 0%, transparent 40%);
    animation: floatBg 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, 2%) rotate(1deg); }
    50% { transform: translate(0, 4%) rotate(0deg); }
    75% { transform: translate(-2%, 2%) rotate(-1deg); }
}

/* Floating Orbs */
body.login-page::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.4));
    border-radius: 50%;
    top: 10%;
    right: -100px;
    filter: blur(60px);
    animation: floatOrb 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatOrb {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.1); }
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 10;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glass Card */
.login-card {
    background: var(--fnz-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    border: 1px solid var(--fnz-border-glass);
    box-shadow: 
        var(--fnz-shadow-soft),
        0 4px 6px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--fnz-primary), var(--fnz-accent), var(--fnz-primary-light));
    background-size: 200% 100%;
    animation: shimmerBar 3s linear infinite;
}

@keyframes shimmerBar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        var(--fnz-shadow-glow),
        0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

/* Brand Icon */
.neu-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--fnz-primary) 0%, var(--fnz-primary-dark) 100%);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 10px 30px rgba(99, 102, 241, 0.4),
        0 4px 8px rgba(99, 102, 241, 0.2);
    position: relative;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4), 0 4px 8px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 15px 40px rgba(99, 102, 241, 0.5), 0 6px 12px rgba(99, 102, 241, 0.3); }
}

.neu-icon:hover {
    transform: scale(1.05) rotate(-3deg);
}

.icon-inner {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.icon-inner svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

/* Brand Name */
.login-header h2 {
    color: var(--fnz-text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-header h2 span {
    background: linear-gradient(135deg, var(--fnz-primary), var(--fnz-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--fnz-text-secondary);
    font-size: 15px;
    font-weight: 400;
}

/* Alert Messages - Flask Flash */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: alertSlide 0.4s ease;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger, .alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    color: var(--fnz-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    color: var(--fnz-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    color: var(--fnz-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.05));
    color: var(--fnz-accent);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

/* Input Group */
.input-group.neu-input {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    overflow: hidden;
}

.input-group.neu-input::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 2px;
    background: linear-gradient(135deg, transparent, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-group.neu-input:focus-within {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--fnz-primary);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.1),
        0 4px 12px rgba(99, 102, 241, 0.15);
}

.input-group.neu-input:focus-within::before {
    background: linear-gradient(135deg, var(--fnz-primary), var(--fnz-accent));
    opacity: 1;
}

.input-group.neu-input input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 20px 20px 12px 52px;
    color: var(--fnz-text-primary);
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    cursor: text;
}

.input-group.neu-input input::placeholder {
    color: transparent;
}

.input-group.neu-input label {
    position: absolute;
    left: 52px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fnz-text-muted);
    font-size: 15px;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.input-group.neu-input input:focus + label,
.input-group.neu-input input:not(:placeholder-shown) + label {
    top: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--fnz-primary);
    transform: translateY(0);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Input Icons */
.input-group.neu-input::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.input-group.neu-input:focus-within::after {
    opacity: 1;
}

/* Password Group */
.input-group.password-group input {
    padding-right: 56px;
}

/* Password Toggle */
/* Password Toggle Button - FIXED VISIBILITY */
.password-toggle.neu-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex !important;  /* ✅ FORCE DISPLAY */
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
    z-index: 100;
}

.password-toggle.neu-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

.password-toggle.neu-toggle .eye-closed {
    display: none;  /* Initially hidden */
}

/* Hover effect */
.password-toggle.neu-toggle:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

/* Error Messages */
.error-message {
    color: var(--fnz-error);
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    margin-left: 4px;
    min-height: 18px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.error-message:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.form-group.error .input-group.neu-input {
    border-color: var(--fnz-error);
    background: rgba(239, 68, 68, 0.05);
}

/* Submit Button */
.neu-button.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--fnz-primary) 0%, var(--fnz-primary-dark) 100%);
    border: none;
    border-radius: 14px;
    padding: 18px 32px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    margin-top: 8px;
    box-shadow: 
        0 8px 24px rgba(99, 102, 241, 0.4),
        0 4px 8px rgba(99, 102, 241, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    letter-spacing: 0.5px;
}

.neu-button.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s ease;
}

.neu-button.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 12px 32px rgba(99, 102, 241, 0.5),
        0 6px 12px rgba(99, 102, 241, 0.3);
}

.neu-button.login-btn:hover::before {
    left: 100%;
}

.neu-button.login-btn:active {
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(99, 102, 241, 0.4),
        0 3px 6px rgba(99, 102, 241, 0.2);
}

.btn-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-text::after {
    content: '\2192';
    font-size: 18px;
    transition: transform 0.3s ease;
}

.neu-button.login-btn:hover .btn-text::after {
    transform: translateX(4px);
}

/* Loading State */
.neu-button.loading {
    pointer-events: none;
}

.neu-button.loading .btn-text {
    opacity: 0;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neu-button.loading .btn-loader {
    opacity: 1;
}

.neu-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer Branding */
.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.login-footer p {
    color: var(--fnz-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.login-footer .brand-name {
    color: var(--fnz-primary);
    font-weight: 700;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    body.login-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: 60px;
    }
    
    .login-card {
        padding: 36px 24px;
        border-radius: 20px;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
    
    .neu-icon {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }
    
    .icon-inner {
        width: 36px;
        height: 36px;
    }
    
    .input-group.neu-input input {
        padding: 18px 18px 10px 48px;
        font-size: 15px;
    }
    
    .input-group.neu-input label {
        left: 48px;
        font-size: 14px;
    }
    
    .neu-button.login-btn {
        padding: 16px 28px;
    }
}

/* Extra: Decorative Elements */
.login-card .decorative-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-card .decorative-circle.top-right {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    top: -40px;
    right: -40px;
}

.login-card .decorative-circle.bottom-left {
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.06) 0%, transparent 70%);
    bottom: -60px;
    left: -60px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visible for Keyboard Navigation */
.neu-button:focus-visible,
.password-toggle:focus-visible,
.input-group.neu-input input:focus-visible {
    outline: 2px solid var(--fnz-primary);
    outline-offset: 2px;
}

/* Mobile Styles (480px and below) - Enhanced for Perfect Fit */
@media (max-width: 480px) {
    body.login-page {
        padding: 0; /* Remove all padding to maximize space */
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        height: 100vh; /* Full screen height */
        overflow: hidden; /* Prevent scroll if needed */
    }
    
    .login-container {
        width: 100vw; /* Full viewport width */
        max-width: 100vw;
        padding: 0; /* No extra padding */
        margin: 0; /* Ensure no margins */
    }
    
    .login-card {
        padding: 20px 16px; /* Minimal padding for content */
        border-radius: 16px;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        box-sizing: border-box;
        /* Add slight top/bottom margin if form feels cramped */
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .login-header {
        margin-bottom: 20px;
    }
    
    .neu-icon {
        width: 60px; /* Smaller icon for fit */
        height: 60px;
        border-radius: 15px;
        margin-bottom: 14px;
    }
    
    .icon-inner {
        width: 30px;
        height: 30px;
    }
    
    .login-header h2 {
        font-size: 1.25rem;
    }
    
    .login-header p {
        font-size: 13px;
    }
    
    .input-group.neu-input input {
        padding: 14px 14px 9px 42px; /* Tighter padding */
        font-size: 16px; /* Prevent zoom */
    }
    
    .input-group.neu-input label {
        left: 42px;
        font-size: 13px;
    }
    
    .password-toggle.neu-toggle {
        width: 34px;
        height: 34px;
        right: 10px;
    }
    
    .neu-button.login-btn {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .login-footer {
        margin-top: 16px;
        padding-top: 12px;
    }
    
    .login-footer p {
        font-size: 12px;
    }
    
    /* Scale down decorative circles to avoid overflow */
    .login-card .decorative-circle.top-right {
        width: 50px;
        height: 50px;
        top: -15px;
        right: -15px;
    }
    
    .login-card .decorative-circle.bottom-left {
        width: 60px;
        height: 60px;
        bottom: -20px;
        left: -20px;
    }
}

/* Extra Small Screens (320px and below) - Ultra-Compact */
@media (max-width: 320px) {
    .login-card {
        padding: 16px 12px; /* Even tighter */
        border-radius: 12px;
    }
    
    .neu-icon {
        width: 52px;
        height: 52px;
        border-radius: 13px;
    }
    
    .icon-inner {
        width: 26px;
        height: 26px;
    }
    
    .login-header h2 {
        font-size: 1.125rem;
    }
    
    .input-group.neu-input input {
        padding: 12px 12px 8px 38px;
        font-size: 16px;
    }
    
    .input-group.neu-input label {
        left: 38px;
        font-size: 12px;
    }
    
    .neu-button.login-btn {
        padding: 12px 18px;
        font-size: 16px;
    }
    
    .login-footer p {
        font-size: 11px;
    }
    
    body.login-page {
        padding: 0;
    }
    
    .login-container {
        padding: 0;
    }
}
