<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{{ 'Access Review' if auth_error else 'Login' }} - BLOOM LIMS</title>
  <link rel="icon" href="/favicon.ico" sizes="any">
  
  <!-- Fonts -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
  
  <!-- Icons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
  
  <!-- Styles -->
  <link rel="stylesheet" href="/static/modern/css/bloom_modern.css">
  
  <style>
    .login-page {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      background: var(--color-gray-900);
      padding: var(--spacing-lg);
    }
    
    .login-container {
      width: 100%;
      max-width: 400px;
    }
    
    .login-header {
      text-align: center;
      margin-bottom: var(--spacing-xl);
    }
    
    .login-logo {
      font-size: 3rem;
      font-weight: 700;
      color: var(--color-highlight);
      margin-bottom: var(--spacing-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: var(--spacing-sm);
    }
    
    .login-logo i {
      color: var(--color-bloom-template);
    }
    
    .login-subtitle {
      color: var(--color-gray-400);
      font-size: 0.875rem;
    }
    
    .login-card {
      background: var(--color-gray-800);
      border-radius: var(--radius-lg);
      padding: var(--spacing-xl);
      box-shadow: var(--shadow-lg);
    }
    
    .login-btn {
      width: 100%;
      padding: var(--spacing-md);
      font-size: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: var(--spacing-sm);
    }
    
    .login-divider {
      display: flex;
      align-items: center;
      margin: var(--spacing-lg) 0;
      color: var(--color-gray-500);
      font-size: 0.875rem;
    }
    
    .login-divider::before,
    .login-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--color-gray-600);
    }
    
    .login-divider span {
      padding: 0 var(--spacing-md);
    }
    
    .login-info {
      margin-top: var(--spacing-lg);
      text-align: center;
      font-size: 0.875rem;
      color: var(--color-gray-400);
    }
    
    .login-footer {
      margin-top: var(--spacing-xl);
      text-align: center;
      font-size: 0.75rem;
      color: var(--color-gray-500);
    }
    
    .login-footer a {
      color: var(--color-gray-400);
    }
    
    .login-footer a:hover {
      color: var(--color-highlight);
    }
  </style>
</head>
<body>
  {% if deployment_chrome.name and not deployment_chrome.is_production %}
  <div style="height: 18px; background: {{ deployment_chrome.color }}; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;">
    {{ deployment_chrome.name|upper }}
  </div>
  {% endif %}
  <div class="bloom-stripe-bar"></div>
  
  <div class="login-page">
    <div class="login-container" style="max-width: 980px;">
      <div class="login-card" style="display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));">
        <div class="login-header" style="margin-bottom: 0; text-align: left;">
          <div class="login-logo">
            <i class="fas fa-spa"></i>
            BLOOM
          </div>
          <p class="login-subtitle">{{ "Access Review" if auth_error else "Authentication Required" }}</p>
          <h1 style="margin: 0.75rem 0 0; font-size: 2.6rem;">{{ "This account could not complete sign-in." if auth_error else "BLOOM Laboratory Access" }}</h1>
          <p class="login-subtitle" style="margin-top: 0.9rem; max-width: 52ch;">
            Laboratory information management access is provisioned per deployment and user role.
          </p>
        </div>
        <div class="login-card" style="margin: 0; background: rgba(17, 24, 39, 0.65); border: 1px solid rgba(148, 163, 184, 0.2);">
          {% if auth_error %}
          <div class="alert alert-error" style="margin-bottom: 1rem;">
            <i class="fas fa-triangle-exclamation"></i>
            {{ auth_error }}
          </div>
          {% endif %}
          <p class="login-subtitle" style="text-transform: uppercase; letter-spacing: 0.12em;">
            {{ "Sign-in was blocked" if auth_error else "Access" }}
          </p>
          <h2 style="margin: 0.4rem 0 0.75rem; font-size: 1.8rem;">{{ "Return to Sign In" if auth_error else "Sign in with AWS Cognito" }}</h2>
          <p class="login-info" style="margin-top: 0; text-align: left;">
            <i class="fas fa-lock"></i> Secure authentication via AWS Cognito
          </p>
          <a href="{{ auth_primary_href | default('/auth/login') }}" class="btn btn-primary login-btn">
            <i class="fas fa-sign-in-alt"></i>
            {{ "Return to Sign In" if auth_error else "Sign in with AWS Cognito" }}
          </a>
        </div>
      </div>
      <div class="login-footer">
        <p>BLOOM LIMS v{{ version | default('1.0.0') }}</p>
      </div>
    </div>
  </div>
  
  <script src="/static/modern/js/bloom_modern.js"></script>
</body>
</html>
