/* Global reset & box sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #0067b8;
  --primary-hover: #005da6;
  --text-main: #1b1b1b;
  --text-muted: #666666;
  --link-color: #0067b8;
  --link-hover: #666666;
  --border-color: #666666;
  --border-focus: #0067b8;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  --font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
}

body {
  font-family: var(--font-family);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #f3f3f3;
  overflow-x: hidden;
}

/* Background image & overlay support */
.background-container {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    url('https://aadcdn.msftauthimages.net/dbd5a2dd-zier9hqtaxw197hwx3w4nqopm7j-li4dvglvlt2ljrm/logintenantbranding/0/illustration');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Page layout */
.page-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
}

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Card base */
.card {
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  padding: 44px;
}

/* Responsive adjustment for mobile */
@media (max-width: 480px) {
  .page-container {
    padding: 0;
    align-items: flex-start;
  }
  
  .auth-wrapper {
    max-width: 100%;
    gap: 0;
  }

  .card {
    box-shadow: none;
    padding: 32px 24px;
    border-radius: 0;
  }

  .secondary-card {
    border-top: 1px solid #e5e5e5;
  }
}

/* Brand area */
.brand-area {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.banner-logo {
  max-width: 280px;
  max-height: 36px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Form Steps */
.form-step {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.form-step.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Headings */
.title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
  line-height: 1.25;
}

/* User display banner for step 2 */
.user-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: #eaeaea;
}

.user-email {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Input group */
.input-group {
  position: relative;
  margin-bottom: 16px;
}

/* Validation error message */
.error-message {
  color: #e81123;
  font-size: 0.8125rem;
  line-height: 1.35;
  margin-bottom: 12px;
  display: none;
  animation: fadeIn 0.15s ease-in-out;
}

.form-control {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0 6px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background: transparent;
  outline: none;
  transition: border-color 0.2s;
}

.form-control.has-error {
  border-bottom: 1px solid #e81123 !important;
}

.form-control.has-error:focus {
  border-bottom: 2px solid #e81123 !important;
  padding-bottom: 5px;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:focus {
  border-bottom: 2px solid var(--border-focus);
  padding-bottom: 5px; /* Offset the 2px border height */
}

/* Support Links */
.support-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.text-sm {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-main);
}

.link {
  color: var(--link-color);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Action Buttons */
.actions {
  display: flex;
  justify-content: flex-end;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 6px 28px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
  min-width: 108px;
  min-height: 32px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
}

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

.btn-primary:focus {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* Secondary Options Section */
.secondary-card {
  padding: 0;
  background: #ffffff;
}

.btn-secondary-options {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-main);
  text-align: left;
  transition: background-color 0.15s;
}

.btn-secondary-options:hover {
  background-color: #f3f3f3;
}

.key-icon {
  width: 28px;
  height: 28px;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

/* Page Footer */
.page-footer {
  width: 100%;
  padding: 16px 28px;
  display: flex;
  justify-content: flex-end;
  background: transparent;
  position: relative;
  z-index: 10;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-link {
  font-size: 0.75rem;
  color: #ffffff;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}

.footer-link:hover {
  text-decoration: underline;
  opacity: 1;
  color: #ffffff;
}

.more-options {
  letter-spacing: 1.5px;
  font-size: 0.85rem;
  font-weight: bold;
}
