/*
 * Habbl login page styling.
 *
 * All brand-specific values are expressed as CSS custom properties on :root so
 * that per-tenant theming (a later phase) can override them without touching
 * any component rules. The default values below are the HABBL brand, taken from
 * the Figma design tokens (Brand/Primary #00A1C6, bluegray/700 #0F2A48, ...).
 */

/* ------------------------------------------------------------------ Fonts */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}

/* ------------------------------------------------------------ Design tokens */
:root {
  /* Brand + surfaces */
  --brand-primary: #00a1c6;      /* Brand/Primary, cyan/700 */
  --brand-primary-hover: #008ead;
  --bg-dark: #0f2a48;            /* bluegray/700 */
  --bg-accent: var(--brand-primary);

  /* Text */
  --text-color: #1c2126;        /* global/textColor */
  --text-muted: #6c757d;        /* input/placeholder/color */

  /* Card */
  --card-bg: #ffffff;
  --card-radius: 8px;
  --card-width: 460px;
  --card-shadow: 0 24px 60px rgba(15, 42, 72, 0.28);

  /* Inputs */
  --input-bg: #ffffff;          /* input/background */
  --input-border: #ced4da;      /* input/borderColor */
  --input-radius: 6px;

  /* Buttons */
  --btn-radius: 28px;
  --provider-border: #e0e0e0;   /* surface/300 */

  /* Optional per-tenant background image (set by theming layer) */
  --login-bg-image: none;

  /* Typography */
  --font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ------------------------------------------------------------------ Layout */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.login-body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/*
 * Branded background: dark navy base with a large brand-colour circle bleeding
 * off the left edge (the HABBL "swoosh"). Recreated in CSS so it scales crisply
 * and can be re-themed via --bg-accent / --login-bg-image alone.
 */
body.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--bg-dark);
  background-image: var(--login-bg-image);
  background-size: cover;
  background-position: center;
}

body.login-body::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 130vh;
  height: 130vh;
  left: -45vh;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background-color: var(--bg-accent);
  /* Hidden when a full-bleed tenant background image is supplied */
  display: var(--bg-circle-display, block);
}

/* ------------------------------------------------------------------ Card */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--card-width);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 44px 52px 28px;
  margin: 24px;
}

.login-logo {
  display: block;
  height: 28px;
  width: auto;
  margin-bottom: 32px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 20px;
  color: var(--text-color);
}

.login-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
  margin: -12px 0 20px;
}

/* --------------------------------------------------------------- Email row */
.login-input-group {
  position: relative;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-color);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input::placeholder { color: var(--text-muted); }

.login-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 161, 198, 0.15);
}

.login-input.input-invalid {
  border-color: #dc3545;
}

.field-error {
  color: #dc3545;
  font-size: 12px;
  margin-top: 6px;
  min-height: 1em;
}

/* ------------------------------------------------------------ Primary CTA */
.login-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  min-height: 40px;
}

.btn-primary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 77px;
  height: 40px;
  padding: 0 20px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--btn-radius);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: background-color 0.15s ease;
}
.btn-primary-pill:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }
.btn-primary-pill:disabled { opacity: 0.6; cursor: default; }

.btn-ghost-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  background: transparent;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
}
.btn-ghost-pill:hover { color: var(--brand-primary); }

/* --------------------------------------------------------------- Back link */
.login-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.login-back:hover { color: var(--text-color); }
.login-back svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------- Divider */
.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0 16px;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 600;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--provider-border);
}
.login-divider span { padding: 0 14px; }

/* ------------------------------------------------------- Provider buttons */
.login-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provider-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  padding: 0 44px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  background: #ffffff;
  border: 2px solid var(--provider-border);
  border-radius: var(--btn-radius);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.provider-btn:hover { background: #f8f9fa; border-color: #d0d0d0; }

.provider-btn .provider-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* ------------------------------------------------------------ Validation */
.login-validation-summary {
  color: #dc3545;
  font-size: 13px;
  margin-bottom: 12px;
}
.login-validation-summary ul { margin: 0; padding-left: 18px; }
.login-validation-summary:empty { display: none; }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 560px) {
  body.login-body { align-items: flex-start; }
  .login-card {
    padding: 32px 24px 24px;
    margin: 0;
    min-height: 100vh;
    border-radius: 0;
    max-width: 100%;
    box-shadow: none;
  }
  body.login-body::after { display: none; }
}
