:root {
  --bg-page: #F4F6F8;
  --bg-card: #FFFFFF;
  --text-main: #1A1A1A;
  --text-muted: #4A4A4A;
  --primary-accent: #004B87;    /* Deep Institutional Blue */
  --primary-hover: #00335E;
  --focus-ring: #005A9C;
  --border-color: #767676;
  --border-light: #D1D5DB;
  --error-bg: #FEF2F2;
  --error-text: #B91C1C;
  --radius: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  line-height: 1.5;
}

.login-container {
  background: var(--bg-card);
  width: 100%;
  max-width: 460px;
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-top: 6px solid var(--primary-accent);
}

/* --- Balanced Logo Architecture --- */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.logo-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
}

/* Constraining aspect ratios so neither logo visually overpowers the other */
.institution-logo {
  max-height: 52px;
  width: auto;
  max-width: 90%;
  object-fit: contain;
}

.presents-divider {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0.25rem 0;
}

.resource-logo {
  max-height: 62px;
  width: auto;
  max-width: 85%;
  object-fit: contain;
}

h1 {
  font-size: 1.35rem;
  color: var(--primary-accent);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* --- Form Controls & WCAG Accessibility --- */
.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.required {
  color: var(--error-text);
  font-weight: 700;
}

small {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* WCAG 2.1 AA Minimum Touch Target (44x44px) & High Contrast Borders */
input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* 3px High-Visibility Keyboard Focus Ring */
input:focus,
button:focus,
a:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--focus-ring);
}

.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  background-color: var(--primary-accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Server-Side Error Alert Styling */
.feedback-area {
  padding: 0;
  border-radius: var(--radius);
  margin-bottom: 0;
  display: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.feedback-area.error {
  display: block;
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #FCA5A5;
  border-left: 4px solid var(--error-text);
}

.login-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  border-top: 1px solid var(--border-light);
  padding-top: 1.25rem;
}

.login-footer a {
  color: var(--primary-accent);
  text-decoration: underline;
  font-weight: 600;
}

.login-footer a:hover {
  color: var(--primary-hover);
}

.support-text {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Mobile Optimization --- */
@media (max-width: 480px) {
  body {
    padding: 0;
    background-color: var(--bg-card);
  }
  
  .login-container {
    padding: 1.75rem 1.25rem;
    box-shadow: none;
    border-top: none;
    max-width: 100%;
  }

  /* Scale logos slightly down on narrow mobile viewports to prevent edge crowding */
  .institution-logo {
    max-height: 48px;
  }
  
  .resource-logo {
    max-height: 36px;
  }
}