/* css/login.css */

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
    padding: 20px;
    box-sizing: border-box;
    overflow: auto; /* Allow scrolling if content is too tall */
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 450px; /* Max width for the login card */
}

.login-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg); /* Consistent with global.css */
    box-shadow: var(--shadow-elevation-2);
    padding: 40px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    animation: fadeInScale 0.5s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.login-header {
    margin-bottom: 30px;
}

.login-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 5px rgba(158, 127, 255, 0.2); /* Primary color glow */
}

.login-header h2 {
    font-size: 2em;
    color: var(--primary); /* Use primary color for main heading */
    margin-bottom: 10px;
    font-weight: 700;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    text-align: left;
    position: relative; /* For inline error messages */
}

.form-group label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    background-color: var(--background); /* Slightly different background for input fields */
    color: var(--text);
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(158, 127, 255, 0.3);
}

/* Inline error message styling */
.form-group .error-message {
    color: var(--error);
    font-size: 0.85em;
    margin-top: 5px;
    min-height: 1.2em; /* Reserve space to prevent layout shift */
    text-align: left;
}

/* Highlight invalid inputs */
.form-group.error input {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 2px rgba(var(--error-rgb), 0.3);
}

/* Password toggle styling */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 45px; /* Make space for the icon */
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1em;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--primary);
}


/* Checkbox styling */
.checkbox-group {
    text-align: left;
    margin: 10px 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--text);
    user-select: none;
    line-height: 1.5;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: var(--background);
    border: 2px solid var(--border);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
    background-color: rgba(158, 127, 255, 0.1);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.btn-submit {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    margin-top: 10px; /* Adjust margin for button */
}

.login-footer {
    margin-top: 30px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: #5A4BBA; /* Darker primary on hover */
    text-decoration: underline;
}

.login-footer p {
    margin-top: 15px;
}

/* Flash message specific styling for login page */
.flash-message {
    margin-bottom: 20px;
    padding: 15px;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--border-radius-md);
}

.flash-message.error {
    background-color: rgba(var(--error-rgb), 0.15);
    color: var(--error);
    border: 1px solid var(--error);
}

.flash-message.success {
    background-color: rgba(var(--success-rgb), 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        border-radius: var(--border-radius-lg);
    }

    .login-header h2 {
        font-size: 1.8em;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .btn-submit {
        padding: 12px;
        font-size: 1em;
    }
}
