/* ============================================================
   Login Dialog — styles
   ============================================================ */

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --ld-primary:      #00226f;
  --ld-primary-dark: #001750;
  --ld-primary-ring: #00226f33;
  --ld-accent:       #0057b8;   /* mid-blue for links / secondary actions */
  --ld-accent-light: #e8f0fb;   /* tinted surface (focus highlights, etc.) */
  --ld-radius:       0.75rem;
  --ld-shadow:       0 25px 50px -12px rgba(0,0,0,.25);
  --ld-transition:   200ms cubic-bezier(.4,0,.2,1);
}

/* ── Trigger button ────────────────────────────────────────── */
.ld-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  background: var(--ld-primary);
  color: #fff;
  border: none;
  border-radius: var(--ld-radius);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ld-transition), transform var(--ld-transition);
}
.ld-trigger-btn:hover  { background: var(--ld-primary-dark); }
.ld-trigger-btn:active { transform: scale(.97); }
.ld-trigger-btn:focus-visible {
  outline: 2px solid var(--ld-primary);
  outline-offset: 3px;
}

/* ── Backdrop ──────────────────────────────────────────────── */
.ld-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem 1rem;
}
.ld-modal[aria-hidden="true"] { display: none; }

.ld-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: ld-fade-in var(--ld-transition) both;
}

/* ── Panel ─────────────────────────────────────────────────── */
.ld-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: calc(var(--ld-radius) * 1.5);
  box-shadow: var(--ld-shadow);
  padding: 2rem 2rem 2.25rem;
  animation: ld-slide-up var(--ld-transition) both;
}

@media (prefers-color-scheme: dark) {
  .ld-panel {
    background: #1e1e2e;
    color: #cdd6f4;
  }
}

/* ── Close button ──────────────────────────────────────────── */
.ld-close {
  position: absolute;
  top: .875rem;
  right: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  color: #6b7280;
  cursor: pointer;
  transition: background var(--ld-transition), color var(--ld-transition);
}
.ld-close:hover { background: #f3f4f6; color: #111827; }
.ld-close:focus-visible { outline: 2px solid var(--ld-primary); outline-offset: 2px; }

@media (prefers-color-scheme: dark) {
  .ld-close { border-color: #313244; color: #a6adc8; }
  .ld-close:hover { background: #313244; color: #cdd6f4; }
}

/* ── Header ────────────────────────────────────────────────── */
.ld-header { text-align: center; margin-bottom: 1.75rem; }

.ld-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.ld-title {
  margin: 0 0 .375rem;
  font-size: 1.375rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
}
.ld-subtitle {
  margin: 0;
  font-size: .875rem;
  color: #6b7280;
}

@media (prefers-color-scheme: dark) {
  .ld-title   { color: #cdd6f4; }
  .ld-subtitle { color: #a6adc8; }
}

/* ── Form fields ───────────────────────────────────────────── */
.ld-form { display: flex; flex-direction: column; gap: 1.125rem; }

.ld-field { display: flex; flex-direction: column; gap: .375rem; }

.ld-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ld-label {
  font-size: .8125rem;
  font-weight: 600;
  color: #374151;
  letter-spacing: .01em;
}
@media (prefers-color-scheme: dark) {
  .ld-label { color: #a6adc8; }
}

.ld-forgot {
  font-size: .8125rem;
  color: var(--ld-accent);
  text-decoration: none;
}
.ld-forgot:hover { text-decoration: underline; }

.ld-input-wrap { position: relative; }

.ld-input {
  width: 100%;
  padding: .625rem .875rem;
  font-size: .9375rem;
  color: #111827;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: .5rem;
  outline: none;
  transition: border-color var(--ld-transition), box-shadow var(--ld-transition), background var(--ld-transition);
  box-sizing: border-box;
}
.ld-input:focus {
  background: #fff;
  border-color: var(--ld-primary);
  box-shadow: 0 0 0 3px var(--ld-primary-ring);
}
.ld-input.ld-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.ld-input-wrap .ld-input { padding-right: 2.75rem; }

@media (prefers-color-scheme: dark) {
  .ld-input {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
  }
  .ld-input:focus { background: #1e1e2e; }
}

/* show/hide password toggle */
.ld-toggle-pw {
  position: absolute;
  right: .625rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  padding: .25rem;
  border-radius: .25rem;
  transition: color var(--ld-transition);
}
.ld-toggle-pw:hover { color: #4b5563; }

/* field-level error */
.ld-field-error {
  font-size: .75rem;
  color: #ef4444;
  min-height: 1em;
}

/* ── Remember me ────────────────────────────────────────────── */
.ld-row-remember { display: flex; align-items: center; }

.ld-checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}
@media (prefers-color-scheme: dark) {
  .ld-checkbox-label { color: #a6adc8; }
}

.ld-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }

.ld-checkbox-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid #d1d5db;
  border-radius: .3125rem;
  background: #fff;
  flex-shrink: 0;
  transition: background var(--ld-transition), border-color var(--ld-transition);
}
.ld-checkbox:checked + .ld-checkbox-custom {
  background: var(--ld-primary);
  border-color: var(--ld-primary);
}
.ld-checkbox:checked + .ld-checkbox-custom::after {
  content: '';
  display: block;
  width: .35rem;
  height: .6rem;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
}
.ld-checkbox:focus-visible + .ld-checkbox-custom {
  outline: 2px solid var(--ld-primary);
  outline-offset: 2px;
}

/* ── Alert ──────────────────────────────────────────────────── */
.ld-alert {
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 500;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.ld-alert[hidden] { display: none; }

/* ── Submit button ──────────────────────────────────────────── */
.ld-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .75rem 1rem;
  background: var(--ld-primary);
  color: #fff;
  border: none;
  border-radius: .625rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ld-transition), transform var(--ld-transition);
  margin-top: .25rem;
}
.ld-submit:hover    { background: var(--ld-primary-dark); }
.ld-submit:active   { transform: scale(.98); }
.ld-submit:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.ld-submit:focus-visible { outline: 2px solid var(--ld-primary); outline-offset: 3px; }

/* ── Spinner ────────────────────────────────────────────────── */
.ld-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ld-spin .65s linear infinite;
}
.ld-spinner[hidden] { display: none; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes ld-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ld-slide-up {
  from { opacity: 0; transform: translateY(1.25rem) scale(.97); }
  to   { opacity: 1; transform: translateY(0)       scale(1);   }
}
@keyframes ld-spin {
  to { transform: rotate(360deg); }
}
