/* --- MD3 & MODERN VARIABLES (Matched with index.css) --- */
:root {
    /* MD3 Color Tokens */
    --md-sys-color-primary: #4f46e5;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #e0e7ff;
    
    --md-sys-color-outline: #79747e; 
    --md-sys-color-outline-variant: #c4c7c5; 
    
    --md-sys-color-surface: #f8fafc; /* Background Page */
    --md-sys-color-surface-container: #ffffff; /* Card Background */
    
    --md-sys-color-on-surface: #1d1b20;
    --md-sys-color-on-surface-variant: #49454f; 
    
    --md-sys-color-error: #b3261e;
    --md-sys-color-error-container: #f9dedc;
    --md-sys-color-success: #166534; 
    --md-sys-color-success-container: #f0fdf4;

    /* Spacing & Radius */
    --md-sys-shape-corner-xs: 4px; 
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px; 
    --md-sys-shape-corner-xl: 28px; 
    --md-sys-shape-corner-full: 100px; 
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px 0px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Figtree', sans-serif; }

body {
    background-color: var(--md-sys-color-surface);
    background-image: radial-gradient(at 0% 0%, hsla(253,16%,7%,0.05) 0, transparent 50%), 
                      radial-gradient(at 50% 0%, hsla(225,39%,30%,0.05) 0, transparent 50%), 
                      radial-gradient(at 100% 0%, hsla(339,49%,30%,0.05) 0, transparent 50%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* --- MAIN CONTAINER --- */
.main-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- MD3 ELEVATED CARD --- */
.login-card {
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-xl); 
    box-shadow: var(--elevation-2);
    width: 100%;
    max-width: 448px; /* Matches index.css */
    padding: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s cubic-bezier(0.2, 0, 0, 1);
}

/* --- BRAND HEADER --- */
.brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    text-align: center;
}

.brand-logo {
    width: 80px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.brand-text h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    line-height: 1.2;
    margin-bottom: 4px;
}

.badge {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
}

.header-text { 
    text-align: center; 
    margin-bottom: 32px; 
}

.header-text h3 {
    font-size: 22px;
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    margin-bottom: 8px;
}

.header-text p { 
    color: var(--md-sys-color-on-surface-variant); 
    font-size: 14px; 
    line-height: 20px;
}

/* --- MD3 OUTLINED TEXT FIELDS --- */
.input-group { margin-bottom: 24px; }
.input-wrapper { position: relative; height: 56px; }

.input-wrapper input {
    width: 100%;
    height: 100%;
    border: 1px solid var(--md-sys-color-outline); 
    border-radius: var(--md-sys-shape-corner-xs);
    padding: 0 48px 0 16px; 
    font-size: 16px;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--md-sys-color-surface-container); 
    padding: 0 4px;
    font-size: 16px;
    z-index: 1;
}

.input-wrapper input:hover {
    border-color: var(--md-sys-color-on-surface); 
}

.input-wrapper input:focus {
    border: 2px solid var(--md-sys-color-primary); 
    padding-left: 15px; 
}

.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label {
    top: 0;
    transform: translateY(-50%) scale(0.75); 
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

/* Error State Logic */
.input-wrapper input.error-field {
    border-color: var(--md-sys-color-error);
}
.input-wrapper input.error-field ~ label {
    color: var(--md-sys-color-error);
}
.input-wrapper input.error-field:focus {
    border-color: var(--md-sys-color-error);
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 20px;
    z-index: 2;
}

/* --- BUTTONS --- */
.btn-primary {
    width: 100%;
    height: 40px; 
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-sys-shape-corner-full); 
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    box-shadow: var(--shadow-sm); 
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    box-shadow: var(--elevation-1); 
    background: #4338ca; 
    transform: translateY(-1px);
}

.btn-primary:active {
    background: #3730a3;
    box-shadow: none;
    transform: translateY(0);
}

/* --- FOOTER --- */
.footer-copy {
    margin-top: 32px;
    text-align: center;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.8;
}

/* --- LINKS (Specific to Forgot Password) --- */
.center-link {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.back-link {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--md-sys-color-primary); }
.back-link:hover i { transform: translateX(-3px); }
.back-link i { transition: transform 0.2s; }

/* --- KEYFRAMES --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- MD3 DIALOG BOX --- */
.dialog-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.32); 
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    backdrop-filter: blur(2px);
}

.dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.md3-dialog {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    width: 90%;
    max-width: 320px;
    padding: 24px;
    border-radius: var(--md-sys-shape-corner-xl); 
    box-shadow: var(--elevation-3);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dialog-overlay.active .md3-dialog {
    transform: scale(1);
    opacity: 1;
}

.dialog-icon {
    font-size: 24px;
    margin-bottom: 16px;
}

.dialog-icon.error-icon { color: var(--md-sys-color-error); }
.dialog-icon.success-icon { color: var(--md-sys-color-success); }

.dialog-headline {
    font-size: 24px;
    line-height: 32px;
    font-weight: 400; 
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface);
}

.dialog-text {
    font-size: 14px;
    line-height: 20px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

.dialog-actions {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
        width: 100%;
    }
    .brand-logo { width: 60px; }
}