/* ForestDS — Keycloak Login Theme */

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

html, body.fds-body {
  height: 100%;
  background: #0d1a12;
  font-family: 'DM Sans', sans-serif;
}

/* ── Layout principal ───────────────────────────────────────── */

.fds-wrap {
  display: flex;
  min-height: 100vh;
}

/* ── Panell esquerre ────────────────────────────────────────── */

.fds-left {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  background: #0d1a12;
  overflow: hidden;
}

.fds-forest-bg {
  position: absolute;
  inset: 0;
  background-size: 140%;
  background-position: 70% center;
  pointer-events: none;
}

.fds-forest-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(4, 24, 12, 0.80) 0%,
    rgba(6, 30, 14, 0.70) 40%,
    rgba(3, 18, 8, 0.85) 100%
  );
}

.fds-forest-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 40, 20, 0.50);
  mix-blend-mode: color;
}

/* ── Capçalera esquerra (logo + desc + línia) ───────────────── */

.fds-left-header {
  position: relative;
  z-index: 2;
}

.fds-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.fds-logo-img {
  max-width: 200px;
  height: auto;
  filter: brightness(0) invert(1);
}

.fds-logo-ctfc {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 60px;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.fds-logo-icon {
  flex-shrink: 0;
  overflow: visible;
}

.fds-logo-desc {
  position: relative;
  z-index: 2;
  color: #c8dfd0;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 14px;
}

.fds-green-line {
  width: 40px;
  height: 2px;
  background: #52b788;
  border-radius: 2px;
}

/* ── Tagline central ────────────────────────────────────────── */

.fds-tagline {
  position: relative;
  z-index: 2;
}

.fds-tagline h1 {
  font-family: 'DM Sans', sans-serif;
  color: #ffffff;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 14px;
}

.fds-tagline p {
  color: #a8c5b5;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
}

/* ── Peu esquerre (trust icons + versió) ────────────────────── */

.fds-left-footer {
  position: relative;
  z-index: 2;
}

.fds-trust-row {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
}

.fds-trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.fds-trust-item span {
  color: #a8c5b5;
  font-size: 12px;
  font-weight: 400;
}

.fds-version {
  color: #3d6b50;
  font-size: 12px;
  font-weight: 300;
}

/* ── Panell dret ────────────────────────────────────────────── */

.fds-right {
  flex: 0 0 48%;
  min-width: 480px;
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 52px;
  position: relative;
}

.fds-saml-btn--primary {
  background: #2d6a4f;
  border-color: #2d6a4f;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  height: 52px;
  margin-top: 8px;
}

.fds-saml-btn--primary:hover {
  background: #1e4f39;
  border-color: #1e4f39;
  color: #ffffff;
}

.fds-saml-btn--secondary {
  background: transparent;
  border-color: #c8d5cc;
  color: #3d6b50;
}

.fds-saml-btn--secondary:hover {
  background: #eef4f0;
  border-color: #2d6a4f;
}

/* ── Separador "o" ──────────────────────────────────────────── */

.fds-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #a0b4a8;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}

.fds-divider::before,
.fds-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dde8e2;
}

.fds-divider-label {
  white-space: nowrap;
  padding: 0 4px;
}

/* ── Selector d'idioma ──────────────────────────────────────── */

.fds-locale {
  position: absolute;
  top: 28px;
  right: 32px;
  z-index: 100;
}

.fds-locale-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #d4ddd7;
  border-radius: 8px;
  padding: 7px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #4a6355;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.fds-locale-toggle:hover {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.08);
}

.fds-locale-chevron {
  transition: transform 0.2s;
  margin-left: 2px;
}

.fds-locale.is-open .fds-locale-chevron {
  transform: rotate(180deg);
}

.fds-locale-dropdown {
  display: none !important;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1.5px solid #d4ddd7;
  border-radius: 8px;
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.fds-locale.is-open .fds-locale-dropdown {
  display: block !important;
}

.fds-locale-dropdown li {
  list-style: none !important;
  list-style-type: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.fds-locale-dropdown li::before,
.fds-locale-dropdown li::marker {
  display: none !important;
  content: none !important;
}

.fds-locale-dropdown li a {
  display: block;
  padding: 9px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #3d6b50;
  text-decoration: none;
  transition: background 0.15s;
}

.fds-locale-dropdown li a:hover {
  background: #eef4f0;
  color: #1b4332;
}

/* ── Targeta del formulari ──────────────────────────────────── */

.fds-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e8ece9;
  box-shadow:
    0 0 0 1px rgba(45, 106, 79, 0.04),
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 12px 32px rgba(0, 0, 0, 0.08);
  padding: 48px 52px 44px;
  width: 100%;
  max-width: 500px;
}

.fds-form-title {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 400;
  color: #1a2e22;
  margin-bottom: 6px;
}

.fds-form-sub {
  font-size: 14px;
  color: #7a8a7e;
  margin-bottom: 32px;
  font-weight: 300;
}

/* ── Alerta d'error ─────────────────────────────────────────── */

.fds-alert {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  font-weight: 400;
}

.fds-alert--error {
  background: #fde8e8;
  color: #8b2020;
  border: 1px solid #f5b8b8;
}

.fds-alert--warning {
  background: #fef3e2;
  color: #7a4f10;
  border: 1px solid #f5d9a0;
}

.fds-alert--success {
  background: #e8f5ee;
  color: #1a5c35;
  border: 1px solid #a8d5b5;
}

.fds-alert--info {
  background: #e8f0fa;
  color: #1a3560;
  border: 1px solid #a8bfe0;
}

/* ── Camps del formulari ────────────────────────────────────── */

.fds-field {
  margin-bottom: 20px;
}

.fds-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #4a6355;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Input amb icona ────────────────────────────────────────── */

.fds-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.fds-input-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
  flex-shrink: 0;
}

.fds-input-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ab0a0;
  transition: color 0.2s;
}

.fds-input-eye:hover {
  color: #4a6355;
}

.fds-input {
  width: 100%;
  height: 48px;
  border: 1.5px solid #d4ddd7;
  border-radius: 10px;
  background: #ffffff;
  padding: 0 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #1a2e22;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}

.fds-input--icon {
  padding-left: 40px;
}

.fds-input--icon-r {
  padding-right: 40px;
}

.fds-input:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.fds-input::placeholder {
  color: #b5c4bb;
}

/* ── Opcions (recorda'm + contrasenya) ──────────────────────── */

.fds-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
}

.fds-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b8070;
  cursor: pointer;
  font-weight: 300;
  white-space: nowrap;
}

.fds-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2d6a4f;
  cursor: pointer;
  flex-shrink: 0;
}

.fds-forgot {
  font-size: 12px;
  color: #2d6a4f;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 400;
  transition: color 0.2s;
  white-space: nowrap;
}

.fds-forgot:hover {
  color: #1b4332;
}

/* ── Botó principal ─────────────────────────────────────────── */

.fds-btn {
  width: 100%;
  height: 50px;
  background: #2d6a4f;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.fds-btn:hover {
  background: #1b4332;
}

.fds-btn:active {
  transform: scale(0.99);
}

.fds-btn--outline {
  background: transparent;
  color: #2d6a4f;
  border: 1.5px solid #2d6a4f;
  text-decoration: none;
}

.fds-btn--outline:hover {
  background: #eef4f0;
  border-color: #1b4332;
  color: #1b4332;
}

/* ── Divisor ────────────────────────────────────────────────── */

.fds-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.fds-divider-line {
  flex: 1;
  height: 1px;
  background: #dce5df;
}

.fds-divider-text {
  font-size: 12px;
  color: #a0b0a5;
  font-weight: 300;
  white-space: nowrap;
}

/* ── Botó SAML / proveïdors socials ─────────────────────────── */

.fds-saml-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  background: transparent;
  border: 1.5px solid #c8d5cc;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #2d6a4f;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-bottom: 8px;
}

.fds-saml-btn:hover {
  background: #eef4f0;
  border-color: #2d6a4f;
}

/* ── Registre inline ────────────────────────────────────────── */

.fds-register-inline {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: #7a8a7e;
  font-weight: 300;
}

.fds-register-inline a {
  color: #1a2e22;
  font-weight: 600;
  text-decoration: none;
  margin-left: 2px;
}

.fds-register-inline a:hover {
  color: #2d6a4f;
  text-decoration: underline;
}

/* ── Camps d'error ──────────────────────────────────────────── */

.fds-input--error {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.fds-field-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #8b2020;
  font-weight: 400;
}

/* ── Fila de dos camps ──────────────────────────────────────── */

.fds-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Panell dret amb scroll (registre) ──────────────────────── */

.fds-right--scroll {
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
  padding-top: 80px;
  padding-bottom: 80px;
}

.fds-right--scroll .fds-locale {
  position: fixed;
}

/* ── Icona recuperació contrasenya ──────────────────────────── */

.fds-reset-icon {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 20px;
}

/* ── Registre (deprecated — usar fds-register-inline) ───────── */

.fds-register {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* ── Step indicator ─────────────────────────────────────────── */

.fds-step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.fds-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  background: #e8f5ee;
  color: #2d6a4f;
  border: 1.5px solid #c8e0d0;
}

.fds-step--active {
  background: #2d6a4f;
  color: #fff;
  border-color: #2d6a4f;
}

.fds-step--done {
  background: #52b788;
  color: #fff;
  border-color: #52b788;
}

.fds-step-line {
  flex: 1;
  height: 1.5px;
  background: #c8e0d0;
  max-width: 40px;
}

/* ── Email badge ─────────────────────────────────────────────── */

.fds-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f5ee;
  border: 1px solid #c8e0d0;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  color: #2d6a4f;
  font-weight: 500;
  margin-bottom: 20px;
}

/* ── Access request ──────────────────────────────────────────── */

.fds-access-request-info {
  font-size: 14px;
  color: #3a4e42;
  line-height: 1.6;
  margin-bottom: 24px;
  padding: 16px;
  background: #fffbf0;
  border: 1px solid #f0d080;
  border-radius: 10px;
}

.fds-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Verify email ───────────────────────────────────────────── */

.fds-verify-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.fds-verify-hint {
  font-size: 13px;
  color: #6b8c78;
  background: #f2f8f4;
  border: 1px solid #c8e0d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ── Footer ─────────────────────────────────────────────────── */

.fds-footer {
  margin-top: 36px;
  text-align: center;
  font-size: 12px;
  color: #a0b0a5;
  font-weight: 300;
}

/* ── Responsive: tablet ──────────────────────────────────────── */

@media (max-width: 900px) {
  .fds-wrap {
    flex-direction: column;
  }

  .fds-left {
    min-height: 220px;
    padding: 36px 32px;
  }

  .fds-tagline h1 {
    font-size: 24px;
  }

  .fds-right {
    flex: unset;
    width: 100%;
    min-width: unset;
    min-height: unset;
    padding: 48px 24px 40px;
  }

  .fds-locale {
    top: 16px;
    right: 20px;
  }
}
