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

:root {
    --primary-color: #10b981; /* Eco Emerald Green */
    --primary-glow: rgba(16, 185, 129, 0.35);
    --secondary-color: #06b6d4; /* Teal */
    --bg-dark: #070a13; /* Deeper dark background to enhance 3D contrast */
    --glass-bg: rgba(10, 15, 30, 0.5); /* Semi-transparent dark glass */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(16, 185, 129, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --error-color: #ef4444;
    --success-color: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

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

/* WebGL Canvas for 3D Background */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through to elements below */
}

/* Glass Card Container */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 10px;
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 28px;
    padding: 40px 35px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.login-card.shake {
    animation: shake-anim 0.4s ease-in-out;
}

@keyframes shake-anim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* Header & Logo */
.brand-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.brand-logo {
    max-width: 150px;
    height: auto;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.brand-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 30%, #a7f3d0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Form Styles */
.login-form {
    width: 100%;
}

.input-group {
    position: relative;
    margin-bottom: 22px;
    width: 100%;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

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

.input-wrapper i.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.05rem;
    transition: color 0.3s ease;
}

.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    outline: none;
    padding: 14px 16px 14px 46px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Autofill styling override for Chrome */
.input-field:-webkit-autofill,
.input-field:-webkit-autofill:hover, 
.input-field:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main) !important;
    -webkit-box-shadow: 0 0 0px 1000px rgba(15, 23, 42, 0.8) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.input-field:focus {
    border-color: var(--glass-border-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 
        0 0 0 3px rgba(16, 185, 129, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.input-group:focus-within .input-label {
    color: var(--primary-color);
}

.input-group:focus-within i.input-icon {
    color: var(--primary-color);
}

/* Password eye toggle */
.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    transition: color 0.3s ease;
}

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

/* Extra controls: Remember me & Forgot Password */
.form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    width: 100%;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.remember-me input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remember-me input:checked + .custom-checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
}

.custom-checkbox i {
    color: #000;
    font-size: 0.7rem;
    font-weight: 900;
    display: none;
}

.remember-me input:checked + .custom-checkbox i {
    display: block;
}

.remember-me span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.forgot-link {
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: #34d399;
    text-decoration: underline;
}

/* Button & Loading State */
.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #059669 100%);
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.submit-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: 0.5s;
}

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #10b981 100%, #10b981 100%);
}

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

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-top: 2px solid #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.submit-btn.loading .btn-spinner {
    display: block;
}
.submit-btn.loading .btn-text {
    display: none;
}

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

/* Toast Alerts */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

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

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

.toast.error {
    border-left: 4px solid var(--error-color);
}
.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast-icon {
    font-size: 1.15rem;
}
.toast.error .toast-icon { color: var(--error-color); }
.toast.success .toast-icon { color: var(--success-color); }

.toast-content {
    flex: 1;
}

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

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

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color 0.2s ease;
    background: none;
    border: none;
    outline: none;
}

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

/* Footer style */
.footer-text {
    margin-top: 25px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        border-radius: 24px;
    }
    
    .brand-logo {
        max-width: 120px;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
        top: 16px;
    }
    
    .toast {
        min-width: 100%;
    }
}
