:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #8b5cf6;
    --accent: #10b981;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #222230;
    --bg-card: rgba(17, 17, 24, 0.8);
    
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-disabled: #64748b;
    
    --border-primary: rgba(59, 130, 246, 0.15);
    --border-secondary: rgba(255, 255, 255, 0.05);
    --border-accent: rgba(59, 130, 246, 0.3);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    --glow-primary: 0 0 30px rgba(59, 130, 246, 0.2);
    --glow-secondary: 0 0 20px rgba(139, 92, 246, 0.15);
    --glow-accent: 0 0 25px rgba(16, 185, 129, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100vh;
}

/* Ambient Background */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 70%),
        linear-gradient(135deg, rgba(59, 130, 246, 0.02) 0%, rgba(139, 92, 246, 0.02) 100%);
}

.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.03;
    background-image: 
        radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: grain 15s steps(10) infinite;
}

/* Floating Elements */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.floating-element {
    position: absolute;
    width: 3px;
    height: 3px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 50%;
    opacity: 0.4;
    animation: float 25s infinite linear;
}

.floating-element:nth-child(1) { left: 10%; animation-delay: 0s; }
.floating-element:nth-child(2) { left: 20%; animation-delay: 3s; }
.floating-element:nth-child(3) { left: 30%; animation-delay: 6s; }
.floating-element:nth-child(4) { left: 40%; animation-delay: 9s; }
.floating-element:nth-child(5) { left: 50%; animation-delay: 12s; }

/* Main Container */
.login-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Left Side - Branding */
.left-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(circle at 30% 40%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    position: relative;
    padding: 60px;
}

.left-side::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--border-primary), transparent);
}

.brand-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
    position: relative;
    animation: logoFloat 6s ease-in-out infinite;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 32px rgba(59, 130, 246, 0.3));
    transition: all 0.3s ease;
}

.brand-logo::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    /* background: linear-gradient(45deg, var(--primary), var(--secondary)); */
    border-radius: 50%;
    opacity: 0.1;
    animation: pulse 4s ease-in-out infinite;
}

.brand-title {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.2);
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.brand-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    max-width: 300px;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

.features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
}

.feature:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-primary);
}

.feature-icon {
    font-size: 24px;
}

/* Right Side - Form */
.right-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 60px;
    background: 
        radial-gradient(circle at 70% 30%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

/* Custom scrollbar */
.right-side::-webkit-scrollbar {
    width: 8px;
}

.right-side::-webkit-scrollbar-track {
    background: transparent;
}

.right-side::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 4px;
}

.right-side::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.3);
}

.login-form-container {
    width: 100%;
    max-width: 420px;
    animation: slideInRight 0.8s ease 0.6s backwards;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.form-group input {
    width: 100%;
    padding: 16px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

/* Password input with toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 50px !important;
}

.password-toggle {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 6px;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* Ensure browser native icons adapt to dark theme */
.form-group input[type="password"] {
    color-scheme: dark;
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-accent);
    background: var(--bg-tertiary);
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Remember Me Checkbox */
.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
    position: relative;
    padding-left: 32px;
}

.remember-me input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-primary);
    border-radius: 5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.remember-me:hover .checkmark {
    border-color: var(--border-accent);
    background: var(--bg-tertiary);
    transform: translateY(-50%) scale(1.05);
}

.remember-me input:checked ~ .checkmark {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-me input:checked ~ .checkmark:after {
    display: block;
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 8px;
}

.forgot-password:hover {
    color: var(--primary-light);
    background: rgba(59, 130, 246, 0.1);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
    animation: shake 0.5s ease;
    backdrop-filter: blur(10px);
}

.login-btn {
    width: 100%;
    padding: 16px 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--glow-primary);
    margin-bottom: 20px;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 14px 36px rgba(59, 130, 246, 0.3);
}

.login-btn:disabled {
    background: var(--text-disabled);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-primary), transparent);
}

.divider span {
    padding: 0 14px;
    font-weight: 500;
}

/* Google Sign-In Styles */
.g_id_signin {
    margin: 0 auto 20px auto !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

.g_id_signin > div {
    margin: 0 auto !important;
}

.g_id_signin iframe {
    margin: 0 auto !important;
    display: block !important;
}

.register-link {
    text-align: center;
    margin-top: 20px;
}

.register-link p {
    color: var(--text-secondary);
    font-size: 13px;
}

.register-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.register-link a:hover {
    color: var(--primary-light);
    background: rgba(59, 130, 246, 0.1);
}

/* Animations */
@keyframes grain {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-5%, -10%) rotate(1deg); }
    20% { transform: translate(-15%, 5%) rotate(-1deg); }
    30% { transform: translate(7%, -25%) rotate(2deg); }
    40% { transform: translate(-5%, 25%) rotate(-2deg); }
    50% { transform: translate(-15%, 10%) rotate(1deg); }
    60% { transform: translate(15%, 0%) rotate(-1deg); }
    70% { transform: translate(0%, 15%) rotate(2deg); }
    80% { transform: translate(3%, 35%) rotate(-2deg); }
    90% { transform: translate(-10%, 10%) rotate(1deg); }
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.05); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .login-container {
        flex-direction: column;
    }

    .left-side {
        flex: none;
        height: 40vh;
        padding: 40px 20px;
    }

    .left-side::before {
        display: none;
    }

    .left-side::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 1px;
        background: linear-gradient(to right, transparent, var(--border-primary), transparent);
    }

    .brand-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }

    .brand-title {
        font-size: 36px;
        margin-bottom: 16px;
    }

    .brand-subtitle {
        font-size: 16px;
    }

    .features {
        display: none;
    }

    .right-side {
        flex: 1;
        padding: 40px 20px;
    }

    .login-form-container {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .login-container {
        min-height: 100vh;
        height: auto;
    }

    .left-side {
        height: 35vh;
        padding: 30px 20px;
    }

    .brand-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 16px;
    }

    .brand-title {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .brand-subtitle {
        font-size: 14px;
        max-width: 250px;
    }

    .right-side {
        padding: 30px 20px;
    }

    .login-header h2 {
        font-size: 28px;
    }

    .login-header p {
        font-size: 14px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    .form-group input {
        padding: 16px 18px;
        font-size: 15px;
    }

    .login-btn {
        padding: 16px 20px;
        font-size: 15px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
}

.login-form label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.login-form {
    margin-bottom: 28px;
    position: relative;
}

/* Custom Password Toggle Styles */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}