/* Login Page Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

:root,
body,
input,
textarea,
button,
select {
  font-family: 'Poppins', sans-serif !important;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg, #f5f5f5);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--text, #333);
}

/* Main content wrapper to center the login box */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 40px 20px;
}

.container {
  background: var(--card-bg, white);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 340px;
}

/* ─── ANNOUNCEMENT BANNER ─── */
.announcement-banner {
  width: 100%;
  padding: 12px 20px;
  text-align: center;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

.announcement-banner.banner-light-text {
  color: #ffffff;
}

.announcement-banner.banner-dark-text {
  color: #000000;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h2 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--header-text, #333);
}

input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  box-sizing: border-box;
}

button {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--primary, #5c67f2);
  color: var(--button-text, white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  min-height: 48px;
}

button:hover {
  background: var(--primary-hover, #4047c0);
}

.toggle,
.forgot {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

.toggle a,
.forgot a {
  color: var(--primary, #5c67f2);
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
}

.error {
  color: red;
  font-size: 14px;
  text-align: center;
  margin-top: 16px;
}

/* reCAPTCHA centered */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

/* Password input wrapper for eye icon toggle */
.password-wrapper {
  position: relative;
  width: 100%;
  margin: 10px 0;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 44px; /* Space for eye icon */
  margin: 0; /* Remove margin, wrapper handles it */
  flex: 1;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  margin: auto;
  height: fit-content;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted, #888);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle:hover {
  color: var(--text, #333);
  background: var(--bg, #f5f5f5);
}

.password-toggle:focus {
  outline: 2px solid var(--primary, #5c67f2);
  outline-offset: 1px;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hide the icon that's not active */
.password-toggle .eye-off {
  display: none;
}

.password-toggle.visible .eye-on {
  display: none;
}

.password-toggle.visible .eye-off {
  display: block;
}

.strength {
  font-size: 12px;
  text-align: right;
}

/* =============================================
   PASSWORD STRENGTH INDICATOR
   ============================================= */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border, #e0e0e0);
  margin-top: 4px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0%;
}

.strength-bar-fill.weak {
  width: 33%;
  background: #ef4444;
}

.strength-bar-fill.moderate {
  width: 66%;
  background: #f59e0b;
}

.strength-bar-fill.strong {
  width: 100%;
  background: #22c55e;
}

/* =============================================
   LEGAL ACCEPTANCE SECTION
   ============================================= */
.legal-acceptance {
  margin: 16px 0;
  padding: 12px;
  background: var(--bg, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
}

.legal-acceptance label {
  display: flex;
  align-items: start;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}

.legal-acceptance input[type="checkbox"] {
  margin-right: 10px;
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.legal-acceptance span {
  color: var(--text, #374151);
}

.legal-acceptance a {
  color: var(--primary, #5c67f2);
  text-decoration: underline;
}

.privacy-disclosure {
  margin-top: 8px;
  padding: 8px;
  background: var(--card-bg, #fff);
  border-left: 3px solid var(--primary, #5c67f2);
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
}

/* =============================================
   LOADING STATE
   ============================================= */
button.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: var(--button-text, #fff);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   DARK MODE SUPPORT
   ============================================= */
html.dark-mode body,
[data-theme="dark"] body {
  background: var(--dark-bg, #121212);
  color: var(--dark-text, #e0e0e0);
}

html.dark-mode .container,
[data-theme="dark"] .container {
  background: var(--dark-card-bg, #1e1e1e);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

html.dark-mode h2,
[data-theme="dark"] h2 {
  color: var(--dark-header-text, #fff);
}

html.dark-mode input,
[data-theme="dark"] input {
  background: var(--dark-input-bg, #2a2a2a);
  border-color: var(--dark-border, #444);
  color: var(--dark-text, #e0e0e0);
}

html.dark-mode input::placeholder,
[data-theme="dark"] input::placeholder {
  color: var(--dark-text-muted, #888);
}

html.dark-mode .legal-acceptance,
[data-theme="dark"] .legal-acceptance {
  background: var(--dark-bg, #1a1a1a);
  border-color: var(--dark-border, #444);
}

html.dark-mode .legal-acceptance span,
[data-theme="dark"] .legal-acceptance span {
  color: var(--dark-text, #e0e0e0);
}

html.dark-mode .privacy-disclosure,
[data-theme="dark"] .privacy-disclosure {
  background: var(--dark-card-bg, #1e1e1e);
  color: var(--dark-text-muted, #aaa);
}

html.dark-mode .error,
[data-theme="dark"] .error {
  color: #f87171;
}

html.dark-mode .password-toggle,
[data-theme="dark"] .password-toggle {
  color: var(--dark-text-muted, #888);
}

html.dark-mode .password-toggle:hover,
[data-theme="dark"] .password-toggle:hover {
  color: var(--dark-text, #e0e0e0);
  background: var(--dark-bg, #2a2a2a);
}

html.dark-mode .strength-bar,
[data-theme="dark"] .strength-bar {
  background: var(--dark-border, #444);
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 480px) {
  .main-content {
    padding: 20px 16px;
  }
  
  .container {
    padding: 28px 20px;
    width: 100%;
    max-width: none;
    border-radius: 8px;
    box-sizing: border-box;
  }
  
  h2 {
    font-size: 22px;
    margin-bottom: 20px;
  }
  
  input {
    padding: 14px 12px;
    font-size: 16px; /* Prevents iOS zoom */
    margin: 8px 0;
    width: 100%;
    box-sizing: border-box;
  }
  
  button {
    padding: 14px;
    font-size: 16px;
    min-height: 48px; /* Touch-friendly */
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .toggle,
  .forgot {
    font-size: 13px;
    margin-top: 16px;
  }
  
  .legal-acceptance {
    padding: 12px;
    margin: 12px 0;
  }
  
  .legal-acceptance label {
    font-size: 13px;
  }
  
  /* Ensure reCAPTCHA fits and stays centered */
  .g-recaptcha {
    transform: scale(0.85);
    transform-origin: center center;
    margin: 12px auto;
  }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
input:focus,
button:focus {
  outline: 2px solid var(--primary, #5c67f2);
  outline-offset: 2px;
}

/* Error message accessibility */
.error[role="alert"] {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
