/* Docuvera Tools -- Auth Dialog Styles
 * Used by: storybook, ui, registry landing pages
 * Design reference: storybook/auth-dialog.html (approved mockup v3)
 * Component mapping: ModalDialog sm + AuthDialog + ExternalAuthButton + OrDivider
 */

/* -- Overlay -- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);                /* --cds-overlay */
  z-index: 8000;                                   /* --dv-z-modal-overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 0s 150ms;
}

.auth-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 150ms ease, visibility 0s;
}

/* -- Dialog container -- */
.auth-dialog {
  --dv-modal-viewport-margin: 4rem;
  width: min(480px, calc(100vw - var(--dv-modal-viewport-margin)));
  min-width: 320px;
  max-height: 85vh;
  border-radius: 0.5rem;
  background: #ffffff;
  border: 1px solid #c6c6c6;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 8100;
  transform: translateY(8px);
  transition: transform 150ms ease;
}

.auth-overlay.open .auth-dialog {
  transform: translateY(0);
}

/* -- Dialog header -- */
.auth-dialog-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 2.5rem 1.5rem;                    /* spacing-07 / spacing-08 / spacing-06 */
  text-align: center;
}

.auth-dialog-title {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  color: #2e3b3b;
  margin: 0;
}

/* -- Dialog body -- */
.auth-dialog-body {
  padding: 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* -- Microsoft SSO button -- */
.btn-microsoft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 13rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  color: #1a1a1a;
  background: #ffffff;
  border: 1px solid #8c8c8c;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 70ms, border-color 70ms;
}

.btn-microsoft:hover {
  background: #f2f2f2;
  border-color: #6e6e6e;
}

.btn-microsoft:active {
  background: #e5e5e5;
}

.btn-microsoft:focus-visible {
  outline: 2px solid #32797b;
  outline-offset: 2px;
}

.btn-microsoft:disabled {
  color: #a8a8a8;
  background: #f4f4f4;
  border-color: #c6c6c6;
  cursor: not-allowed;
}

.btn-microsoft:disabled:hover {
  background: #f4f4f4;
  border-color: #c6c6c6;
}

.btn-microsoft:disabled svg {
  opacity: 0.5;
}

.btn-microsoft svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* -- SSO section -- */
.auth-sso-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.auth-sso-help {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: #5e7070;
  text-align: center;
  margin: 0;
  line-height: 1.34;
}

/* -- "or" divider -- */
.auth-divider {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  width: auto;
  background: #e0e0e0;
}

.auth-divider span {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: #5e7070;
  text-transform: lowercase;
  letter-spacing: 0.32px;
}

/* -- Form fields stack -- */
.auth-form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-field label {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.34;
  color: #2e3b3b;
  letter-spacing: 0.32px;
}

.auth-field input {
  height: 2.5rem;
  padding: 0 1rem;
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  color: #131717;
  background: #f4f4f4;
  border: none;
  border-bottom: 1px solid #8d8d8d;
  outline: none;
  transition: border-color 70ms, outline 70ms;
}

.auth-field input:focus {
  outline: 2px solid #32797b;
  outline-offset: -2px;
}

.auth-field input::placeholder {
  color: #a8a8a8;
}

/* -- Primary submit button -- */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 1rem;
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.29;
  letter-spacing: 0.16px;
  color: #ffffff;
  background: #32797b;
  border: none;
  cursor: pointer;
  transition: background-color 70ms;
}

.btn-submit:hover {
  background: #235a5c;
}

.btn-submit:active {
  background: #163c3d;
}

.btn-submit:focus-visible {
  outline: 2px solid #32797b;
  outline-offset: -2px;
}

.btn-submit:disabled {
  background: #c6c6c6;
  color: #8d8d8d;
  cursor: not-allowed;
}

/* -- Forgot password link -- */
.auth-forgot {
  text-align: right;
}

.auth-forgot a {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: #32797b;
  text-decoration: none;
}

.auth-forgot a:hover {
  text-decoration: underline;
}

/* -- Dialog bottom spacer -- */
.auth-dialog-spacer {
  height: 3rem;
  flex-shrink: 0;
}

/* -- Error message -- */
.auth-error {
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.34;
  color: #da1e28;
  text-align: center;
  margin: 0;
  min-height: 1rem;
}

.auth-error:empty {
  display: none;
}

/* -- Responsive: side-by-side on short wide viewports -- */
@media (max-height: 700px) and (min-width: 720px) {
  .auth-dialog {
    width: min(680px, calc(100vw - var(--dv-modal-viewport-margin)));
  }

  .auth-dialog-header {
    padding: 2rem 2.5rem 1rem;
  }

  .auth-dialog-body {
    flex-direction: row;
    padding: 0 2.5rem;
    gap: 0;
  }

  .auth-sso-section {
    flex: 1;
    justify-content: center;
    padding-right: 1.5rem;
  }

  .auth-divider {
    flex-direction: column;
    width: auto;
    margin: 0;
    padding: 0.5rem 0;
    align-self: stretch;
  }

  .auth-divider::before,
  .auth-divider::after {
    width: 1px;
    height: auto;
    min-height: 1rem;
    flex: 1;
    background: #e0e0e0;
  }

  .auth-form-section {
    flex: 1;
    padding-left: 1.5rem;
  }

  .auth-dialog-spacer {
    height: 3rem;
  }
}

/* -- Mobile: narrow viewport -- */
@media (max-width: 480px) {
  .auth-dialog-header {
    padding: 2rem 1.5rem 1rem;
  }

  .auth-dialog-body {
    padding: 0 1.5rem;
    flex-direction: column;
    gap: 1.5rem;
  }

  .auth-divider {
    flex-direction: row;
    align-self: auto;
    padding: 0;
    margin: 0.25rem 0;
  }

  .auth-divider::before,
  .auth-divider::after {
    width: auto;
    height: 1px;
    min-height: auto;
  }

  .auth-sso-section {
    padding-right: 0;
  }

  .auth-form-section {
    padding-left: 0;
  }
}
