/* ==========================================================================
   KANZA WORKSPACE - LOGIN & PIN AUTHENTICATION THEME
   Vibes: Dashboard Match (Light Sage & Emerald accents, crisp cards)
   ========================================================================== */

.login-page-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: #f0f4f1;
  background-image: 
    radial-gradient(at 0% 0%, rgba(206, 237, 214, 0.45) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(216, 234, 201, 0.35) 0px, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #213b33;
}

/* Dark mode support if user prefers */
:root[data-theme="dark"] .login-page-body,
@media (prefers-color-scheme: dark) {
  .login-page-body {
    background-color: #171c18;
    background-image: 
      radial-gradient(at 0% 0%, rgba(32, 115, 88, 0.15) 0px, transparent 50%),
      radial-gradient(at 100% 100%, rgba(13, 48, 40, 0.25) 0px, transparent 50%);
    color: #d6ded8;
  }
}

.login-modal-wrapper {
  width: 100%;
  max-width: 580px;
  padding: 24px 16px;
  margin: auto;
}

/* Modal Dialog Window like Dashboard Popups */
.login-modal-card {
  background: #ffffff;
  border: 1px solid #e1e7e2;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(18, 61, 33, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  position: relative;
}

:root[data-theme="dark"] .login-modal-card,
@media (prefers-color-scheme: dark) {
  .login-modal-card {
    background: #222723;
    border-color: #39433b;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  }
}

/* Modal Header with Title & Badge */
.login-modal-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid #edf1ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

:root[data-theme="dark"] .login-modal-header,
@media (prefers-color-scheme: dark) {
  .login-modal-header {
    border-bottom-color: #333c35;
  }
}

.login-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-app-symbol {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
  background: #edf5ef;
  padding: 4px;
}

.login-modal-title {
  font-size: 18px;
  font-weight: 550;
  letter-spacing: -0.3px;
  margin: 0;
  color: inherit;
}

.login-modal-subtitle {
  font-size: 11px;
  color: #79877f;
  margin-top: 2px;
}

:root[data-theme="dark"] .login-modal-subtitle,
@media (prefers-color-scheme: dark) {
  .login-modal-subtitle {
    color: #a2afa5;
  }
}

.status-badge-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #edf5ef;
  border: 1px solid #d2e6d7;
  color: #207358;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

:root[data-theme="dark"] .status-badge-online,
@media (prefers-color-scheme: dark) {
  .status-badge-online {
    background: #26332a;
    border-color: #3b5242;
    color: #9cbea6;
  }
}

.status-dot-pulse {
  width: 6px;
  height: 6px;
  background: #207358;
  border-radius: 50%;
}

:root[data-theme="dark"] .status-dot-pulse,
@media (prefers-color-scheme: dark) {
  .status-dot-pulse {
    background: #4ade80;
  }
}

/* Body Content */
.login-modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Banner Alert - matches dashboard note */
.login-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f4faf6;
  border: 1px solid #d8ebd9;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #213b33;
}

:root[data-theme="dark"] .login-info-banner,
@media (prefers-color-scheme: dark) {
  .login-info-banner {
    background: #202b23;
    border-color: #39433b;
    color: #d6ded8;
  }
}

.login-info-banner svg {
  width: 17px;
  height: 17px;
  color: #207358;
  flex-shrink: 0;
  margin-top: 1px;
}

.login-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff0f0;
  border: 1px solid #fad2d2;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px;
  color: #bc4141;
}

.login-error-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Section Header */
.form-group-title {
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 1px;
  color: #207358;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

:root[data-theme="dark"] .form-group-title,
@media (prefers-color-scheme: dark) {
  .form-group-title {
    color: #9cbea6;
  }
}

.form-group-title span.sub {
  font-size: 10.5px;
  font-weight: 400;
  color: #79877f;
  text-transform: none;
  letter-spacing: normal;
}

/* Roles List */
.role-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-choice-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fbfdfc;
  border: 1px solid #e2e8e4;
  border-radius: 10px;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  color: inherit;
}

:root[data-theme="dark"] .role-choice-card,
@media (prefers-color-scheme: dark) {
  .role-choice-card {
    background: #1e2420;
    border-color: #354037;
  }
}

.role-choice-card:hover {
  background: #f3f8f5;
  border-color: #badfc4;
}

:root[data-theme="dark"] .role-choice-card:hover,
@media (prefers-color-scheme: dark) {
  .role-choice-card:hover {
    background: #273029;
    border-color: #4b6252;
  }
}

.role-choice-card.is-active {
  background: #edf6f1;
  border-color: #207358;
  box-shadow: 0 0 0 1px #207358;
}

:root[data-theme="dark"] .role-choice-card.is-active,
@media (prefers-color-scheme: dark) {
  .role-choice-card.is-active {
    background: #2b3b30;
    border-color: #50785d;
    box-shadow: 0 0 0 1px #50785d;
  }
}

.role-avatar-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e2ede6;
  color: #1c6149;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

:root[data-theme="dark"] .role-avatar-icon,
@media (prefers-color-scheme: dark) {
  .role-avatar-icon {
    background: #2d3d32;
    color: #c6ed9c;
  }
}

.role-choice-card.is-active .role-avatar-icon {
  background: #207358;
  color: #ffffff;
}

:root[data-theme="dark"] .role-choice-card.is-active .role-avatar-icon {
  background: #365f49;
  color: #e4eee6;
}

.role-avatar-icon svg {
  width: 17px;
  height: 17px;
}

.role-details {
  flex: 1;
  min-width: 0;
}

.role-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 550;
}

.role-pill {
  font-size: 9.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: #edf3ee;
  color: #63776c;
}

:root[data-theme="dark"] .role-pill,
@media (prefers-color-scheme: dark) {
  .role-pill {
    background: #2c362e;
    color: #a2afa5;
  }
}

.role-choice-card.is-active .role-pill {
  background: #d8ecdf;
  color: #17523f;
}

:root[data-theme="dark"] .role-choice-card.is-active .role-pill {
  background: #394d3f;
  color: #b2d1bc;
}

.role-description {
  font-size: 11px;
  color: #79877f;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

:root[data-theme="dark"] .role-description,
@media (prefers-color-scheme: dark) {
  .role-description {
    color: #a2afa5;
  }
}

.radio-selection-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #c8d3cb;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.role-choice-card.is-active .radio-selection-dot {
  border-color: #207358;
}

.radio-inner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #207358;
}

:root[data-theme="dark"] .radio-inner-dot,
@media (prefers-color-scheme: dark) {
  .radio-inner-dot {
    background: #9cbea6;
  }
}

/* PIN Input Field - matches form inputs in dashboard */
.pin-input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pin-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.pin-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: #79877f;
  pointer-events: none;
}

.pin-styled-input {
  width: 100%;
  height: 42px;
  background: #ffffff;
  border: 1px solid #d2dcd5;
  border-radius: 8px;
  padding: 0 14px 0 38px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 550;
  letter-spacing: 4px;
  color: inherit;
  outline: none;
  transition: all 0.15s ease;
}

:root[data-theme="dark"] .pin-styled-input,
@media (prefers-color-scheme: dark) {
  .pin-styled-input {
    background: #1e241f;
    border-color: #4b5a4f;
    color: #d6ded8;
  }
}

.pin-styled-input:focus {
  border-color: #207358;
  box-shadow: 0 0 0 3px rgba(32, 115, 88, 0.15);
}

.pin-hint-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  font-size: 10.5px;
  color: #79877f;
  line-height: 1.6;
}

:root[data-theme="dark"] .pin-hint-list,
@media (prefers-color-scheme: dark) {
  .pin-hint-list {
    color: #a2afa5;
  }
}

.pin-chip {
  cursor: pointer;
  background: #edf5ef;
  border: 1px solid #d2e6d7;
  padding: 2px 7px;
  border-radius: 5px;
  color: #207358;
  font-weight: 500;
  transition: all 0.15s ease;
}

:root[data-theme="dark"] .pin-chip,
@media (prefers-color-scheme: dark) {
  .pin-chip {
    background: #2b3b30;
    border-color: #3d5444;
    color: #b2d1bc;
  }
}

.pin-chip:hover {
  background: #d8ecdf;
  border-color: #207358;
}

.pin-chip code {
  font-weight: 600;
}

/* Modal Footer & Submit Button */
.login-modal-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid #edf1ee;
  background: #fafcfb;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

:root[data-theme="dark"] .login-modal-footer,
@media (prefers-color-scheme: dark) {
  .login-modal-footer {
    border-top-color: #333c35;
    background: #1e241f;
  }
}

.btn-kanza-primary {
  width: 100%;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #1c6149;
  border: 1px solid #1c6149;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(28, 97, 73, 0.2);
}

.btn-kanza-primary:hover:not(:disabled) {
  background: #154c39;
  border-color: #154c39;
  box-shadow: 0 4px 12px rgba(28, 97, 73, 0.3);
}

.btn-kanza-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-kanza-primary svg {
  width: 16px;
  height: 16px;
}

.spinner-mini {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.footer-copyright {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #94a096;
}

@media (max-width: 600px) {
  .login-modal-header,
  .login-modal-body,
  .login-modal-footer {
    padding-inline: 18px;
  }
  .login-modal-title {
    font-size: 16px;
  }
  .role-headline {
    font-size: 12.5px;
  }
  .role-description {
    font-size: 10.5px;
  }
}

/* Compact PIN-only login adjustments */
.login-modal-wrapper.is-compact {
  max-width: 460px;
}

.pin-styled-input.has-toggle {
  padding-right: 42px;
}

.pin-styled-input::placeholder {
  letter-spacing: normal;
  font-size: 13px;
  font-weight: 400;
  color: #8b9a90;
}

.pin-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #79877f;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pin-toggle-btn:hover {
  background: #edf5ef;
  color: #207358;
}

.pin-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Modern Login Polish & Shake Feedback */
@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.pin-field-wrapper.has-error .pin-styled-input {
  border-color: #d94b4b;
  box-shadow: 0 0 0 3px rgba(217, 75, 75, 0.14);
  animation: pin-shake 0.34s ease;
}

@media (max-width: 600px) {
  .login-page-body {
    align-items: flex-start;
    padding-top: max(20px, env(safe-area-inset-top));
  }
  .login-modal-wrapper {
    padding: 16px 14px 28px;
  }
  .pin-styled-input {
    height: 46px;
    font-size: 18px;
  }
  .btn-kanza-primary {
    height: 46px;
    font-size: 14px;
  }
}
