/* =============================================================================
   Exam Login & Portal Access Gateway — Kazi Nazrul Academy
   File: pages/css/exam-login.css
   Authoritative design matching KNA tokens: Plus Jakarta Sans, Sky/Navy palette
   ============================================================================= */

:root {
  --brand: #0ea5e9;
  --brand-accent: #0284c7;
  --brand-dark: #0369a1;
  --brand-light: #e0f2fe;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 35px -10px rgba(15, 23, 42, 0.15), 0 10px 15px -5px rgba(15, 23, 42, 0.06);
}

body.exam-login-body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 0%, #e0f2fe 0%, #f8fafc 45%, #f1f5f9 100%);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.exam-auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  position: relative;
}

.exam-auth-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transition: all 0.3s ease;
}

.exam-auth-header {
  padding: 32px 32px 20px;
  text-align: center;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--gray-100);
  position: relative;
}

.exam-auth-crest {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: contain;
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.2);
}

.exam-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #bae6fd;
  margin-bottom: 8px;
}

.exam-auth-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.exam-auth-subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: var(--gray-500);
  line-height: 1.45;
}

/* Alert Notification Banner */
.exam-alert-banner {
  margin: 16px 32px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.exam-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.exam-alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.exam-alert-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.exam-alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* Segmented Capsule Tabs */
.exam-auth-tabs {
  display: flex;
  padding: 6px;
  margin: 20px 32px 0;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  gap: 4px;
}

.exam-auth-tab-btn {
  flex: 1;
  padding: 10px 16px;
  min-height: 44px;
  box-sizing: border-box;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-family: var(--font-family);
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.exam-auth-tab-btn.active {
  background: #ffffff;
  color: var(--brand-accent);
  box-shadow: var(--shadow-sm);
}

.exam-auth-body {
  padding: 24px 32px 32px;
}

.exam-form-group {
  margin-bottom: 18px;
}

.exam-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.exam-form-label .req {
  color: #dc2626;
  margin-left: 2px;
}

.exam-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.exam-input-icon {
  position: absolute;
  left: 14px;
  color: var(--gray-400);
  font-size: 0.9rem;
  pointer-events: none;
}

.exam-input {
  width: 100%;
  padding: 11px 44px 11px 40px;
  font-family: var(--font-family);
  font-size: 0.92rem;
  color: var(--gray-900);
  background: #ffffff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.exam-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.exam-input-toggle {
  position: absolute;
  right: 4px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.exam-input-toggle:hover {
  color: var(--gray-700);
}

/* Captcha Layout */
.exam-captcha-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.exam-captcha-question {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: 0.02em;
}

.exam-captcha-refresh {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  color: var(--gray-600);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.exam-captcha-refresh:hover {
  background: #ffffff;
  color: var(--brand-accent);
  border-color: var(--brand);
}

/* Action Button */
.btn-exam-submit {
  width: 100%;
  padding: 13px 20px;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-accent) 100%);
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.btn-exam-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.35);
}

.btn-exam-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Button Content & Animated Spinner */
.btn-text-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  line-height: 1;
}

.btn-icon-leading {
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-text-label {
  letter-spacing: 0.01em;
  display: inline-block;
  white-space: nowrap;
  font-size: 0.96rem;
  font-weight: 700;
}

.btn-icon-trailing {
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-exam-submit:hover:not(:disabled) .btn-icon-trailing {
  transform: translateX(4px);
}

.btn-spinner-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  width: 100%;
  line-height: 1;
}

.btn-spinner-ring {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: btnSpinRing 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes btnSpinRing {
  to { transform: rotate(360deg); }
}

.btn-spinner-text {
  display: inline-block;
  letter-spacing: 0.01em;
}

.exam-auth-links {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
}

.exam-auth-link {
  color: var(--brand-accent);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s ease;
}

.exam-auth-link:hover {
  text-decoration: underline;
  color: var(--brand-dark);
}

.exam-gateway-return {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
  text-align: center;
  font-size: 0.82rem;
  color: var(--gray-500);
}

.exam-gateway-return a {
  color: var(--gray-700);
  font-weight: 700;
  text-decoration: none;
}

.exam-gateway-return a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Modal Styling */
.exam-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.exam-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.exam-modal-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 28px;
  position: relative;
  text-align: center;
  transform: translateY(10px);
  transition: transform 0.25s ease;
}

.exam-modal-overlay.active .exam-modal-card {
  transform: translateY(0);
}

.exam-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}

.exam-modal-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
}

.exam-modal-sub {
  margin: 0 0 20px;
  font-size: 0.88rem;
  color: var(--gray-500);
  line-height: 1.5;
}

.exam-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-modal-primary {
  padding: 10px 22px;
  min-height: 42px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-family);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-modal-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.btn-modal-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.btn-modal-outline {
  padding: 10px 20px;
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-family);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

/* =============================================================================
   Responsive Breakpoints & Touch Optimization
   ============================================================================= */
@media (max-width: 480px) {
  .exam-auth-wrapper {
    padding: 24px 12px;
  }

  .exam-auth-card {
    border-radius: 16px;
  }

  .exam-auth-header {
    padding: 24px 18px 16px;
  }

  .exam-auth-crest {
    width: 54px;
    height: 54px;
    margin-bottom: 8px;
  }

  .exam-auth-title {
    font-size: 1.3rem;
  }

  .exam-auth-subtitle {
    font-size: 0.82rem;
  }

  .exam-alert-banner {
    margin: 12px 18px 0;
  }

  .exam-auth-tabs {
    margin: 16px 18px 0;
  }

  .exam-auth-body {
    padding: 20px 18px 24px;
  }

  .exam-modal-card {
    padding: 22px 18px;
  }
}

@media (max-width: 360px) {
  .exam-auth-tab-btn {
    font-size: 0.8rem;
    padding: 8px 10px;
    gap: 5px;
  }

  .exam-modal-actions {
    flex-direction: column;
  }

  .btn-modal-primary,
  .btn-modal-outline {
    width: 100%;
  }
}
