* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0056b3 0%, #001b44 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Prevent scrollbar appearance from causing layout shift */
    scrollbar-gutter: stable;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Set max height and flex layout to prevent content from pushing down */
    display: flex;
    flex-direction: column;
    /* Allow card to be at most 90vh, keeping space for margins */
    max-height: 90vh;
}

.login-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    background: linear-gradient(135deg, #0056b3 0%, #001b44 100%);
    color: white;
    /* Prevent header from shrinking or expanding */
    flex-shrink: 0;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: white;
    stroke-width: 2;
    margin: 0 auto;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Image logo replacement */
.logo-image {
    width: 96px;
    height: auto;
    max-width: 40%;
    display: block;
    margin: 0 auto 0.75rem auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.12));
    image-rendering: auto;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.login-header p {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
}

.login-form {
    padding: 2rem;
    /* Allow form to grow if content is small, or scroll if content is large */
    flex: 1;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    letter-spacing: 0.025em;
}

.form-group input:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    /* No height change on focus */
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    background: white;
    /* Set explicit line-height to prevent content reflow */
    line-height: 1.5;
    /* Prevent autofill from changing background colors abruptly */
}

.form-group input::placeholder {
    color: #9ca3af;
}

.password-input-container {
    position: relative;
}

.password-input-container input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-password:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: #0056b3;
}

.eye-icon, .eye-off-icon {
    width: 18px;
    height: 18px;
}

.login-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #0056b3 0%, #001b44 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-top: 1rem;
    letter-spacing: 0.025em;
    line-height: 1.5;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    color: #e74c3c;
    background-color: #fef5f5;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-align: center;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.login-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid #f3f4f6;
    background-color: #fafbfc;
    /* Prevent footer from shrinking or expanding */
    flex-shrink: 0;
}

.copyright {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }

    .login-header {
        padding: 2rem 1.5rem 1.25rem;
    }

    .login-form {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.625rem;
    }

    .login-header p {
        font-size: 0.875rem;
    }
}

/* Animation for card entrance */
.login-card {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}