/**
 * BDL Login — viewport-locked UMS product entry
 * Auth forms unchanged. Showcase uses real UMS screen visuals.
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bdl-login-teal: #149F85;
  --bdl-login-teal-hover: #0f8a72;
  --bdl-login-navy: #0F2744;
  --bdl-login-text: #1A1C1E;
  --bdl-login-muted: #6B7280;
  --bdl-login-border: #E5E7EB;
  --bdl-login-card: #FFFFFF;
  --bdl-login-canvas: #FFFFFF;
  --bdl-login-energy: #149F85;
  --bdl-login-water: #1660A7;
  --bdl-login-gas: #B87A00;
  --bdl-login-radius: 20px;
  --bdl-login-shadow: 0 12px 40px rgba(15, 39, 68, 0.12), 0 2px 8px rgba(15, 39, 68, 0.05);
  --bdl-login-shadow-sm: 0 4px 18px rgba(15, 39, 68, 0.08);
}

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

html {
  height: 100%;
}

body.bdl-login-body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  color: var(--bdl-login-text);
  /* Background image from shared bdl-auth-background.css */
  -webkit-font-smoothing: antialiased;
}

.bdl-login-page {
  height: 100%;
  max-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  position: relative;
  overflow: hidden;
  background: transparent;
}

/* —— Showcase —— */
.bdl-login-showcase {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: clamp(20px, 3.2vh, 36px) clamp(20px, 3vw, 48px) clamp(20px, 3.2vh, 36px) clamp(24px, 3.5vw, 52px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.bdl-login-showcase__eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bdl-login-teal);
}

.bdl-login-showcase__title {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--bdl-login-navy);
  max-width: 28ch;
}

.bdl-login-showcase__sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--bdl-login-muted);
  max-width: 42ch;
}

.bdl-login-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px;
  padding: 4px 10px;
  width: fit-content;
  border-radius: 999px;
  background: rgba(20, 159, 133, 0.1);
  color: var(--bdl-login-teal);
  font-size: 11px;
  font-weight: 600;
}

.bdl-login-live__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bdl-login-teal);
  box-shadow: 0 0 0 0 rgba(20, 159, 133, 0.45);
  animation: bdl-login-pulse 2.2s ease-out infinite;
}

.bdl-login-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: min(920px, 96%);
  margin-top: 4px;
}

.bdl-login-win {
  position: absolute;
  background: var(--bdl-login-card);
  border: 1px solid var(--bdl-login-border);
  border-radius: 14px;
  box-shadow: var(--bdl-login-shadow);
  overflow: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

.bdl-login-win--primary {
  width: min(94%, 780px);
  height: min(84%, 500px);
  left: 0;
  top: 4%;
  z-index: 3;
  transform: translateY(16px) scale(0.97);
  animation: bdl-login-enter-primary 700ms cubic-bezier(0.4, 0, 0.2, 1) 120ms forwards;
}

.bdl-login-win--secondary {
  width: min(50%, 360px);
  height: min(48%, 280px);
  right: 0;
  bottom: 0;
  z-index: 4;
  transform: translate(18px, 18px) scale(0.96);
  animation: bdl-login-enter-secondary 750ms cubic-bezier(0.4, 0, 0.2, 1) 320ms forwards;
}

.bdl-login-win__chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--bdl-login-border);
}

.bdl-login-win__dots {
  display: flex;
  gap: 5px;
}

.bdl-login-win__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D1D5DB;
}

.bdl-login-win__dots span:nth-child(1) { background: #F87171; }
.bdl-login-win__dots span:nth-child(2) { background: #FBBF24; }
.bdl-login-win__dots span:nth-child(3) { background: #34D399; }

.bdl-login-win__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--bdl-login-muted);
}

.bdl-login-win__body {
  position: relative;
  height: calc(100% - 31px);
  background: #F8FAFC;
  overflow: hidden;
}

.bdl-login-win__body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  display: block;
  transform: scale(1);
  transition: transform 8s ease;
}

.bdl-login-win.is-float .bdl-login-win__body img {
  animation: bdl-login-ken 14s ease-in-out infinite alternate;
}

.bdl-login-win.is-float {
  animation:
    bdl-login-enter-primary 700ms cubic-bezier(0.4, 0, 0.2, 1) 120ms forwards,
    bdl-login-float 7s ease-in-out 1s infinite;
}

.bdl-login-win--secondary.is-float {
  animation:
    bdl-login-enter-secondary 750ms cubic-bezier(0.4, 0, 0.2, 1) 320ms forwards,
    bdl-login-float-alt 8s ease-in-out 1.2s infinite;
}

/* Mini live strip under stage (hydrated if API available) */
.bdl-login-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.bdl-login-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--bdl-login-border);
  background: #FFFFFF;
  box-shadow: var(--bdl-login-shadow-sm);
  font-size: 11px;
  color: var(--bdl-login-muted);
  opacity: 0;
  transform: translateY(8px);
  animation: bdl-login-fade-up 500ms ease 550ms forwards;
}

.bdl-login-stat:nth-child(2) { animation-delay: 650ms; }
.bdl-login-stat:nth-child(3) { animation-delay: 750ms; }
.bdl-login-stat:nth-child(4) { animation-delay: 850ms; }

.bdl-login-stat__ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: #F3F4F6;
}

.bdl-login-stat--energy .bdl-login-stat__ico { color: var(--bdl-login-energy); background: #E7F7F3; }
.bdl-login-stat--water .bdl-login-stat__ico { color: var(--bdl-login-water); background: #E8F0F8; }
.bdl-login-stat--gas .bdl-login-stat__ico { color: var(--bdl-login-gas); background: #FFF6E5; }
.bdl-login-stat--all .bdl-login-stat__ico { color: #4B5563; background: #F3F4F6; }

.bdl-login-stat b {
  color: var(--bdl-login-navy);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* —— Login panel —— */
.bdl-login-panel {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 2.5vh, 28px) clamp(16px, 2.5vw, 36px);
  min-height: 0;
  overflow: hidden;
}

.bdl-login-card {
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow: auto;
  background: var(--bdl-login-card);
  border: 1px solid var(--bdl-login-border);
  border-radius: var(--bdl-login-radius);
  box-shadow: var(--bdl-login-shadow-sm);
  padding: clamp(28px, 4vh, 40px) clamp(24px, 3vw, 40px) clamp(24px, 3.5vh, 36px);
  opacity: 0;
  transform: translateY(12px);
  animation: bdl-login-fade-up 550ms ease 200ms forwards;
}

.bdl-login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.bdl-login-brand img {
  height: 34px;
  width: auto;
  display: block;
}

.bdl-login-card__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bdl-login-navy);
}

.bdl-login-card__sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--bdl-login-muted);
  line-height: 1.4;
}

.bdl-login-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #FDECEC;
  color: #B91C2E;
  font-size: 13px;
  line-height: 1.4;
}

.bdl-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bdl-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bdl-login-field label {
  font-size: 12px;
  font-weight: 600;
  color: #4B5563;
}

.bdl-login-field input[type="email"],
.bdl-login-field input[type="password"],
.bdl-login-field input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #D0D7E2;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--bdl-login-text);
  background: #FFFFFF;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.bdl-login-field input:focus {
  outline: none;
  border-color: #FFC622;
  box-shadow: 0 0 0 3px rgba(250 244 114 / 18%);
}

.bdl-login-pass {
  position: relative;
}

.bdl-login-pass input {
  padding-right: 42px;
}

.bdl-login-pass__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bdl-login-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bdl-login-pass__toggle:hover {
  background: #F3F4F6;
  color: var(--bdl-login-text);
}

.bdl-login-pass__toggle:focus-visible {
  outline: 2px solid #FFC622;
  outline-offset: 1px;
}

.bdl-login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
}

.bdl-login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4B5563;
  cursor: pointer;
  user-select: none;
}

.bdl-login-remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--bdl-login-teal);
}

.bdl-login-forgot {
  font-size: 13px;
  font-weight: 500;
  color: var(--bdl-login-teal);
  text-decoration: none;
}

.bdl-login-forgot:hover {
  text-decoration: underline;
}

.bdl-login-submit {
  width: 100%;
  height: 44px;
  margin-top: 2px;
  border: 0;
  border-radius: 10px;
  background: #FFC622;
  color: #1A1C1E;
  font-size: 14px;
  font-weight: 600;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.bdl-login-submit:hover {
  background: #F0B800;
  color: #1A1C1E;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bdl-login-submit:focus-visible {
  outline: 2px solid #1A1C1E;
  outline-offset: 2px;
}

.bdl-login-footer {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--bdl-login-muted);
}

.bdl-login-footer a {
  color: #1A1C1E;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 150ms ease;
}

.bdl-login-footer a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.bdl-login-mode-signup .bdl-login-form--signin,
.bdl-login-mode-signin .bdl-login-form--signup {
  display: none;
}

.bdl-login-mode-signup .bdl-login-form--signup,
.bdl-login-mode-signin .bdl-login-form--signin {
  display: flex;
}

.bdl-login-mode-signup .bdl-login-copy--signin,
.bdl-login-mode-signin .bdl-login-copy--signup {
  display: none;
}

/* —— Motion —— */
@keyframes bdl-login-enter-primary {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bdl-login-enter-secondary {
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}

@keyframes bdl-login-fade-up {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bdl-login-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes bdl-login-float-alt {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@keyframes bdl-login-ken {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

@keyframes bdl-login-pulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 159, 133, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(20, 159, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 159, 133, 0); }
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .bdl-login-page {
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 1fr);
  }

  .bdl-login-win--primary {
    width: min(92%, 680px);
    height: min(82%, 440px);
  }

  .bdl-login-win--secondary {
    width: min(48%, 300px);
    height: min(46%, 240px);
  }
}

@media (max-width: 900px) {
  body.bdl-login-body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    max-height: none;
  }

  .bdl-login-page {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .bdl-login-showcase {
    padding: 24px 20px 8px;
    order: 1;
  }

  .bdl-login-stage {
    height: 200px;
    flex: none;
    max-width: none;
  }

  .bdl-login-win--primary {
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
  }

  .bdl-login-win--secondary {
    display: none;
  }

  .bdl-login-stats {
    justify-content: center;
  }

  .bdl-login-panel {
    order: 0;
    padding: 24px 20px 12px;
    align-items: flex-start;
  }

  .bdl-login-card {
    max-width: 440px;
    margin: 0 auto;
    overflow: visible;
  }

  .bdl-login-showcase__title,
  .bdl-login-showcase__sub,
  .bdl-login-showcase__eyebrow {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .bdl-login-live {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 520px) {
  .bdl-login-stage {
    height: 150px;
  }

  .bdl-login-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .bdl-login-brand {
    justify-content: center;
  }

  .bdl-login-stat span:not(.bdl-login-stat__ico) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bdl-login-win,
  .bdl-login-win--primary,
  .bdl-login-win--secondary,
  .bdl-login-win.is-float,
  .bdl-login-win--secondary.is-float,
  .bdl-login-card,
  .bdl-login-stat,
  .bdl-login-live__dot,
  .bdl-login-win__body img {
    animation: none !important;
    transition: none !important;
  }

  .bdl-login-win--primary,
  .bdl-login-win--secondary,
  .bdl-login-card,
  .bdl-login-stat {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Short desktop viewports — keep everything in frame */
@media (max-height: 760px) and (min-width: 901px) {
  .bdl-login-showcase {
    padding-top: 16px;
    padding-bottom: 16px;
    gap: 10px;
  }

  .bdl-login-showcase__sub {
    display: none;
  }

  .bdl-login-card {
    padding: 24px 28px;
  }

  .bdl-login-brand {
    margin-bottom: 14px;
  }

  .bdl-login-card__sub {
    margin-bottom: 14px;
  }

  .bdl-login-win--primary {
    height: min(80%, 420px);
    width: min(92%, 720px);
  }

  .bdl-login-win--secondary {
    height: min(44%, 230px);
    width: min(46%, 300px);
  }
}

@media (max-height: 640px) and (min-width: 901px) {
  .bdl-login-showcase__title {
    font-size: 18px;
  }

  .bdl-login-stats {
    display: none;
  }
}
