:root {
    --primary: #013F00;
    --primary-light: #0a5c05;
    --secondary: #FE0002;
    --dark: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --error: #ef4444;
    --success: #10b981;
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    height: 100vh;
    overflow: hidden;
}

.login-page-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- Brand Section (Left) --- */
.brand-section {
    flex: 1.2;
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    overflow: hidden;
}

/* Animated Mesh Gradient Overlay */
.brand-section::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: rotateMesh 20s linear infinite;
}

@keyframes rotateMesh {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(2px);
}

.brand-content {
    position: relative;
    z-index: 10;
    color: var(--white);
    max-width: 600px;
}

.brand-logo {
    width: 110px;
    height: auto;
    margin-bottom: 2.5rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.institution-name {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.divider {
    width: 60px;
    height: 4px;
    background: var(--white);
    border-radius: 2px;
    margin-bottom: 1.5rem;
}

.system-tagline {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-footer {
    padding: 3rem 4rem;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.login-footer p {
    font-size: 0.85rem;
    opacity: 0.8;
    color: var(--white);
    margin: 0;
}

/* --- Form Section (Right) --- */
.form-section {
    flex: 1;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.login-card-container {
    width: 100%;
    max-width: 440px;
}

.login-header {
    margin-bottom: 2.5rem;
}

.auth-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    color: var(--text-muted);
    font-weight: 500;
}

/* Alert Styling */
.alert-custom {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: var(--error);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 0.95rem; /* Increased size */
    font-weight: 500; /* Increased weight */
    margin-bottom: 2rem;
}

/* Form Styling */
.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: block; /* Ensure full container width */
    width: 100%;
}

.input-wrapper i:first-child {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: var(--transition);
    z-index: 5;
}

.invalid-feedback {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 2.5rem !important; /* Extra space to accommodate absolute error message */
}

.form-control {
    height: 52px;
    padding-left: 3rem;
    padding-right: 3.5rem; /* Accommodate icons */
    border-radius: var(--radius-md);
    border: 1.5px solid #e2e8f0;
    background-color: #f8fafc;
    font-weight: 500;
    transition: var(--transition);
}

input#password.is-invalid {
    background-position: right 3rem center !important; /* Move error icon left to prevent overlapping the eye */
}
input#email.is-invalid {
    background-position: right calc(0.375em + 0.1875rem) center !important; /* Bootstrap default */
}

.form-control:focus {
    background-color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(1, 63, 0, 0.1);
}

.form-control:focus + i {
    color: var(--primary);
}

.password-toggle {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--text-muted) !important;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.password-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.password-toggle i {
    position: static;
    transform: none;
    font-size: 1.2rem;
}

/* Hide native Edge/IE password reveal button which conflicts with our custom toggle */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

.password-toggle:hover {
    color: var(--primary);
    background: #f1f5f9;
}

.forgot-link {
    font-size: 0.8125rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Custom Checkbox */
.custom-check .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    border-radius: 4px;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
}

.custom-check .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-check .form-check-label {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Auth Button */
.btn-auth {
    height: 54px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(1, 63, 0, 0.2);
}

.btn-auth:hover {
    background: #002b00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(1, 63, 0, 0.3);
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-loading {
    opacity: 0.8;
    pointer-events: none;
}

.auth-footer p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

/* Modal Styling */
.custom-modal {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-icon-wrapper {
    width: 70px;
    height: 70px;
    background: #eff6ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 50%;
    margin: 0 auto;
}

.btn-modal-close {
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    height: 50px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

.btn-modal-close:hover {
    background: #e2e8f0;
}

/* --- Animations --- */
.animate-fade-in { animation: fadeIn 0.8s ease-out forwards; }
.animate-fade-in-slow { animation: fadeIn 1.2s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .brand-section { padding: 2rem; }
    .institution-name { font-size: 2.25rem; }
}

@media (max-width: 850px) {
    body { overflow-y: auto; }
    .login-page-wrapper { flex-direction: column; height: auto; min-height: 100vh; }
    .brand-section { display: none; } /* Hide left panel on smaller screens for focus */
    .form-section { padding: 2rem 1rem; min-height: 100vh; }
    .login-card-container { margin: auto; }
}