/* Sign-in pages: admin, team portal, client portal (login / forgot / reset).
   Markup: includes/partials/auth-shell-top.php + auth-shell-bottom.php.
   Self-contained (no Bootstrap CSS). Each role gets its own accent. */
:root {
  --auth-accent: #4f46e5;
  --auth-accent-dark: #4338ca;
  --auth-accent-soft: #eef2ff;
  --auth-brand-from: #1e1b4b;
  --auth-brand-to: #312e81;
  --auth-ink: #0f172a;
  --auth-text: #334155;
  --auth-muted: #64748b;
  --auth-faint: #94a3b8;
  --auth-line: #e2e8f0;
  --auth-bg: #f8fafc;
  --auth-surface: #fff;
  --auth-danger: #dc2626;
  --auth-danger-soft: #fef2f2;
  --auth-success: #16a34a;
  --auth-success-soft: #f0fdf4;
  --auth-warning: #b45309;
  --auth-warning-soft: #fffbeb;
  --auth-radius: 12px;
}
.auth-role-team {
  --auth-accent: #0f766e;
  --auth-accent-dark: #115e59;
  --auth-accent-soft: #f0fdfa;
  --auth-brand-from: #042f2e;
  --auth-brand-to: #134e4a;
}
.auth-role-client {
  --auth-accent: #2563eb;
  --auth-accent-dark: #1d4ed8;
  --auth-accent-soft: #eff6ff;
  --auth-brand-from: #0b1b3f;
  --auth-brand-to: #1e3a8a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}
.auth-body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.auth-body a {
  color: var(--auth-accent);
  text-decoration: none;
}
.auth-body a:hover {
  color: var(--auth-accent-dark);
  text-decoration: underline;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 44%) 1fr;
}

/* ── Brand panel ───────────────────────────────────────────── */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 44px 56px;
  color: #fff;
  background:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 22px
      22px,
    linear-gradient(
      150deg,
      var(--auth-brand-from) 0%,
      var(--auth-brand-to) 100%
    );
}
.auth-brand-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--auth-accent) 0%, transparent 65%);
  opacity: 0.55;
  pointer-events: none;
}
.auth-brand > :not(.auth-brand-glow) {
  position: relative;
}

.auth-brand-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.auth-brand-logo img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}
.auth-brand-logo-fallback {
  font-weight: 800;
  font-size: 16px;
  color: var(--auth-accent);
}
.auth-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-brand-body {
  max-width: 460px;
}
.auth-eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.auth-headline {
  margin: 18px 0 28px;
  font-size: clamp(26px, 2.6vw, 38px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.auth-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.86);
}
.auth-point-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 16px;
  flex-shrink: 0;
}
.auth-brand-foot {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.55);
}

/* ── Form side ─────────────────────────────────────────────── */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.auth-panel {
  width: 100%;
  max-width: 410px;
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 36px;
  background: #eef1f5;
  border-radius: var(--auth-radius);
}
.auth-switch-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--auth-muted) !important;
  text-decoration: none !important;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.auth-switch-item:hover {
  color: var(--auth-ink) !important;
}
.auth-switch-item.is-active {
  background: var(--auth-surface);
  color: var(--auth-accent) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.auth-title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--auth-ink);
}
.auth-sub {
  margin: 0 0 28px;
  color: var(--auth-muted);
  font-size: 14.5px;
}

.auth-field {
  margin-bottom: 18px;
}
.auth-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.auth-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text);
}
.auth-label-link {
  font-size: 12.5px;
  font-weight: 600;
}

.auth-input-wrap {
  position: relative;
}
.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-faint);
  font-size: 16px;
  pointer-events: none;
}
.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background: var(--auth-surface);
  font: inherit;
  font-size: 14.5px;
  color: var(--auth-ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.auth-input::placeholder {
  color: var(--auth-faint);
}
.auth-input:hover {
  border-color: #cbd5e1;
}
.auth-input:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-accent) 15%, transparent);
}
.auth-input:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--auth-accent);
}
.auth-input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}
.auth-input-wrap.has-toggle .auth-input {
  padding-right: 48px;
}
.auth-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-faint);
  font-size: 17px;
  cursor: pointer;
}
.auth-eye:hover {
  color: var(--auth-ink);
  background: #f1f5f9;
}
.auth-eye:focus-visible {
  outline: 2px solid var(--auth-accent);
  outline-offset: 1px;
}
.auth-hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--auth-muted);
}

.auth-btn {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--auth-radius);
  background: var(--auth-accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px
    color-mix(in srgb, var(--auth-accent) 70%, transparent);
  transition:
    background 0.15s ease,
    transform 0.05s ease;
}
.auth-btn:hover {
  background: var(--auth-accent-dark);
}
.auth-btn:active {
  transform: translateY(1px);
}
.auth-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--auth-accent) 35%, transparent);
  outline-offset: 2px;
}
.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-alt {
  margin-top: 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--auth-muted);
}

/* Alerts */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: var(--auth-radius);
  border: 1px solid;
  font-size: 13.5px;
  line-height: 1.45;
}
.auth-alert i {
  font-size: 16px;
  line-height: 1.2;
}
.auth-alert--danger {
  background: var(--auth-danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}
.auth-alert--success {
  background: var(--auth-success-soft);
  border-color: #bbf7d0;
  color: #166534;
}
.auth-alert--warning {
  background: var(--auth-warning-soft);
  border-color: #fde68a;
  color: var(--auth-warning);
}

/* Demo account */
.auth-demo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 26px;
  border: 1.5px dashed color-mix(in srgb, var(--auth-accent) 40%, transparent);
  border-radius: var(--auth-radius);
  background: var(--auth-accent-soft);
}
.auth-demo-text {
  flex: 1;
  min-width: 0;
}
.auth-demo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--auth-ink);
}
.auth-demo-creds {
  font-size: 12.5px;
  color: var(--auth-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-demo-creds code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--auth-ink);
}
.auth-demo-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--auth-accent);
  border-radius: 9px;
  background: var(--auth-surface);
  color: var(--auth-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.auth-demo-btn:hover {
  background: var(--auth-accent);
  color: #fff;
}

.auth-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--auth-line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--auth-faint);
}
.auth-footer a {
  color: var(--auth-muted);
  font-weight: 600;
}
.auth-version {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef1f5;
  font-size: 11px;
  font-weight: 700;
}

/* Spinner used by button-loading.js (Bootstrap CSS is not loaded here) */
.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 0.18em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: -0.125em;
}
@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-copy-mobile {
  display: none;
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--auth-faint);
}

/* ── Tablet / phone: brand panel becomes a short header ─────── */
@media (max-width: 991.98px) {
  .auth-copy-mobile { display: block; }
  .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .auth-brand {
    padding: 22px 20px 26px;
    gap: 18px;
  }
  .auth-brand-glow {
    width: 320px;
    height: 320px;
    right: -120px;
    bottom: -180px;
  }
  .auth-points,
  .auth-brand-foot {
    display: none;
  }
  .auth-headline {
    margin: 12px 0 0;
    font-size: 22px;
  }
  .auth-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .auth-main {
    align-items: flex-start;
    padding: 28px 16px 40px;
  }
  .auth-switch {
    margin-bottom: 26px;
  }
  .auth-title {
    font-size: 24px;
  }
}
@media (max-width: 400px) {
  .auth-demo {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner-border {
    animation-duration: 2s;
  }
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-muted) !important;
}
.auth-back:hover { color: var(--auth-ink) !important; text-decoration: none !important; }
.auth-btn-link { text-decoration: none !important; color: #fff !important; }
