:root {
    --bg-primary: #111113;
    --bg-secondary: #1C1C1F;
    --border-color: #333;
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --accent-color: #ffffff;
    --accent-hover: #dddddd;
    --error-color: #ff5c5c;
    --success-color: #2ecc71;
    --font-body: 'Inter', sans-serif;
    --font-heading: 'Poppins', sans-serif;
    --header-height: 72px; 
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif;}
html { height: 100%; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 4.5rem 1.5rem;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.brand-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 500;
}

.brand-logo img {
    height: 36px;
    width: 36px;
}

.content-wrapper {
    width: 100%;
    display: grid;
    overflow: hidden; 
    position: relative;
}

.view {
    grid-area: 1 / 1 / 2 / 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* --- MODIFICATION: FASTER SLIDE ANIMATION --- */
    transition: transform 0.3s ease-out;
}

#auth-view { transform: translateX(0); }
#reset-view { transform: translateX(100%); }

.content-wrapper.show-reset-view #auth-view { transform: translateX(-100%); }
.content-wrapper.show-reset-view #reset-view { transform: translateX(0); }

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}
.pop-in {
    animation: popIn 0.3s ease-out forwards;
}

#auth-view h1, #reset-view h1 { font-family: var(--font-heading); font-size: 2.2rem; margin-bottom: 2.5rem; text-align: center; }
#reset-view p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 2rem; font-size: 0.95rem; text-align: center; }
.social-login-stack { display: flex; gap: 0.75rem; }
.btn-google, .btn-github, .btn-submit { -webkit-tap-highlight-color: transparent; transition: background-color 0.2s, transform 0.1s ease-out; }
.btn-google:active, .btn-github:active, .btn-submit:active { transform: scale(0.97); }

.btn-google, .btn-github { flex: 1; padding: 12px; border-radius: 50px; font-size: 1rem; font-weight: 500; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
.btn-google { background: var(--accent-color); color: var(--bg-primary); }
.btn-google:hover { background-color: var(--accent-hover); }
.btn-google img { height: 20px; width: 20px; }
.btn-github { background: #24292e; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-github:hover { background-color: #333; }
.btn-github ion-icon { font-size: 1.4rem; }

.divider {
    display: flex; align-items: center; text-align: center;
    color: var(--text-secondary); font-size: 0.8rem; margin: 1.5rem 0;
}
.divider::before, .divider::after {
    content: ''; flex: 1; border-bottom: 1px solid var(--border-color);
}
.divider:not(:empty)::before { margin-right: .75em; }
.divider:not(:empty)::after { margin-left: .75em; }

input, textarea {
background-color: #111113; /* dark background */
color: #f0f0f0;            /* text color */
caret-color: #f0f0f0;      /* cursor color */
border: 1px solid #333;
spellcheck: false;          /* removes red underline */
}

/* Remove Chrome autofill noise completely */
input:-webkit-autofill,
textarea:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px #111113 inset !important;
-webkit-text-fill-color: #f0f0f0 !important;
background-clip: content-box !important; /* removes inner noise */
-webkit-text-fill-color: #f0f0f0 !important;
}

.input-group { position: relative; margin-bottom: 1rem; }
.input-field {
    width: 100%; padding: 14px 18px;
    background-color: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: 45px; color: var(--text-primary);
    font-size: 1rem; transition: all 0.2s ease;
}
/* --- MODIFICATION: Original input focus restored --- */
.input-field:focus { 
    outline: none; 
    border-color: var(--accent-color); 
}
.floating-label { 
    position: absolute; top: 15px; left: 20px; font-size: 1rem;
    color: var(--text-secondary); pointer-events: none; transition: all 0.2s ease; 
}
.input-field:focus ~ .floating-label, .input-field:not(:placeholder-shown) ~ .floating-label { 
    top: -8px; left: 15px; font-size: 0.75rem;
    color: var(--accent-color); background: var(--bg-primary); 
    padding: 0 4px; border-radius: 50px;
}

.form-options { text-align: right; margin-bottom: 2rem; }
.form-options a { color: var(--text-secondary); font-size: 0.85rem; text-decoration: none; transition: color 0.2s; }
.form-options a:hover { color: var(--accent-color); }
#password-toggle {
    position: absolute; top: 16px; right: 20px;
    color: var(--text-secondary); cursor: pointer; font-size: 1.3rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#password-toggle:hover { color: var(--text-primary); }
#password-toggle.active { transform: rotateY(180deg); }

.btn-submit { 
    width: 100%; padding: 14px; border: none; border-radius: 50px; 
    background: var(--accent-color); color: var(--bg-primary); 
    font-size: 1rem; font-weight: 600; cursor: pointer; height: 51px; position: relative; 
}
.auth-toggle, .back-to-login { text-align: center; color: var(--text-secondary); margin-top: 1.5rem; font-size: 0.9rem; }
.auth-toggle a, .back-to-login a { color: var(--accent-color); font-weight: 500; text-decoration: none; cursor: pointer; }
.hidden { display: none !important; }

/* --- MODIFICATION: Improved & Centered Loader --- */
.spinner {
    width: 24px; height: 24px;
    border: 2px solid rgba(0,0,0,0.3);
    border-top-color: var(--bg-primary);
    border-radius: 50%; 
    animation: spin 0.8s linear infinite;
    position: absolute; 
    top: 50%; left: 50%;
    margin-top: -12px;
    margin-left: -12px;
    opacity: 0;
    transition: opacity 0.2s;
}
.btn-submit.loading .spinner { opacity: 1; }
.btn-submit.loading .btn-text { visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }

.message-box { padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; text-align: center; margin-bottom: 1rem; display: none; opacity: 0; transition: opacity 0.3s ease-out; line-height: 1.5; }
.message-box.visible { display: block; opacity: 1; }
.error-message { background-color: rgba(255, 92, 92, 0.1); color: var(--error-color); border: 1px solid rgba(255, 92, 92, 0.2); }
.success-message { background-color: rgba(46, 204, 113, 0.1); color: var(--success-color); border: 1px solid rgba(46, 204, 113, 0.2); }

.form-footer { text-align: center; margin-top: 2.5rem; color: var(--text-secondary); font-size: 0.8rem; }
.form-footer a { color: var(--text-secondary); text-decoration: none; margin: 0 0.5rem; transition: color 0.2s; }
.form-footer a:hover { color: var(--text-primary); }

@media (min-width: 768px) {
    body { padding: 0; padding-top: var(--header-height); padding-bottom: 3rem; justify-content: center; }
    .brand-header {
        position: fixed; top: 0; left: 0; right: 0; justify-content: flex-start;
        padding: 1.25rem 2.5rem; background-color: #00000000;
        z-index: 1000; margin-bottom: 0; height: var(--header-height);
    }
}
@media (max-width: 480px) { .social-login-stack { flex-direction: column; } }