/* ==========================================================================
   1. DESIGN TOKENS (Meta Unified Auth & Account Creation System)
   ========================================================================== */
:root {
  --bg-canvas: #ffffff;
  --bg-btn-neutral: #f0f2f5;
  --bg-btn-neutral-hover: #e4e6eb;
  --border-hairline: #dee3e9;
  --border-input: #cbd2d9;
  --border-input-hover: #9aa5b1;
  --border-input-focus: #1c2b33;
  --brand-blue: #0866ff;
  --brand-blue-btn: #0064e0;
  --brand-blue-btn-hover: #0056c2;
  --brand-blue-btn-active: #004aa8;
  --brand-blue-tint: #eef5ff;
  --text-primary: #1c1e21;
  --text-secondary: #65676b;
  --text-footer: #737373;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 18px 42px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
  --font-display: "Optimistic Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-input: 14px;
  --radius-pill: 9999px;
  --right-pane-width: clamp(400px, 31vw, 590px);
}

/* ==========================================================================
   2. RESET Y BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   3. VISTA 1: LOGIN SPLIT-SCREEN (ESCRITORIO)
   ========================================================================== */
.fb-shell {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--right-pane-width);
  width: 100%;
  min-height: calc(100vh - 116px);
}

.fb-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(210px, 290px) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: clamp(24px, 2.6vw, 38px) clamp(24px, 2.6vw, 38px) clamp(32px, 4vw, 52px);
  overflow: hidden;
  background-color: var(--bg-canvas);
}

.fb-brand-link {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  z-index: 10;
}

.fb-hero-copy {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  z-index: 10;
}

.fb-hero-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 3.6vw, 56px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.fb-hero-accent {
  color: var(--brand-blue-btn);
}

/* Collage central con contenedores preparados para fotos locales */
.fb-collage-slot {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline-start: clamp(90px, 10vw, 170px);
  pointer-events: none;
  user-select: none;
}

.fb-collage {
  position: relative;
  width: 560px;
  height: 560px;
  flex-shrink: 0;
  transform-origin: center center;
}

.media-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.media-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-marketplace {
  background:
    radial-gradient(circle at 68% 36%, rgba(86, 130, 62, 0.92) 0%, transparent 48%),
    radial-gradient(circle at 28% 55%, rgba(162, 68, 48, 0.78) 0%, transparent 45%),
    radial-gradient(circle at 46% 88%, rgba(212, 206, 196, 0.85) 0%, transparent 50%),
    linear-gradient(155deg, #2b3526 0%, #3d4834 45%, #5c5145 100%);
}

.media-story {
  background:
    radial-gradient(ellipse at 52% 26%, rgba(208, 132, 92, 0.92) 0%, rgba(162, 86, 56, 0.65) 28%, transparent 55%),
    radial-gradient(circle at 70% 62%, rgba(214, 56, 36, 0.9) 0%, transparent 44%),
    radial-gradient(circle at 44% 78%, rgba(14, 114, 245, 0.95) 0%, rgba(10, 86, 204, 0.85) 34%, transparent 62%),
    linear-gradient(180deg, #c6d7e6 0%, #dbe5ef 34%, #825243 68%, #1d57a8 100%);
}

.media-post {
  background:
    linear-gradient(168deg, transparent 48%, rgba(124, 96, 70, 0.45) 48.5%, rgba(186, 152, 118, 0.88) 72%, #8e6c4f 100%),
    radial-gradient(circle at 32% 68%, rgba(222, 186, 148, 0.95) 0%, transparent 56%),
    linear-gradient(180deg, #b8cde0 0%, #e4d8ca 42%, #c9a786 100%);
}

.media-avatar {
  background:
    radial-gradient(circle at 46% 42%, rgba(242, 88, 34, 0.95) 0%, transparent 32%),
    radial-gradient(circle at 52% 60%, rgba(146, 86, 56, 0.92) 0%, transparent 38%),
    radial-gradient(circle at 48% 92%, rgba(28, 72, 128, 0.95) 0%, transparent 46%),
    linear-gradient(145deg, #2173c9 0%, #64b0e6 42%, #d89b52 75%, #24486b 100%);
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.14) 100%);
  pointer-events: none;
}

.card-marketplace {
  position: absolute;
  top: 96px;
  left: 36px;
  width: 212px;
  height: 218px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  z-index: 1;
}

.badge-marketplace {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  z-index: 3;
}

.sticker-emoji {
  position: absolute;
  top: 38px;
  left: 6px;
  width: 56px;
  height: 56px;
  transform: rotate(-12deg);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.16));
  z-index: 6;
}

.card-story {
  position: absolute;
  top: 16px;
  left: 182px;
  width: 244px;
  height: 416px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
  z-index: 2;
}

.story-progress {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  z-index: 4;
}

.story-progress span {
  height: 2.5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.42);
}

.story-progress span:first-child {
  background: rgba(255, 255, 255, 0.94);
}

.story-bottom-ui {
  position: absolute;
  bottom: 16px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 4;
}

.story-reply-pill {
  flex: 1;
  height: 26px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(4px);
}

.story-react-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
}

.sticker-time {
  position: absolute;
  top: 66px;
  left: 368px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7a6bf0 0%, #5f4ee0 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(95, 78, 224, 0.32);
  z-index: 6;
}

.sticker-heart {
  position: absolute;
  top: 316px;
  left: 396px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4778 0%, #f02849 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 26px rgba(240, 40, 73, 0.34);
  z-index: 7;
}

.card-post {
  position: absolute;
  top: 256px;
  left: 78px;
  width: 186px;
  padding: 11px 11px 28px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-elevated);
  z-index: 4;
}

.card-post-header {
  display: flex;
  align-items: center;
  margin-bottom: 9px;
}

.badge-favorite {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-post-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
}

.card-avatar-ring {
  position: absolute;
  top: 396px;
  left: 204px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 4px;
  background: #ffffff;
  border: 3.5px solid var(--brand-blue);
  box-shadow: var(--shadow-elevated);
  z-index: 8;
}

.card-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.fb-auth-pane {
  border-inline-start: 1px solid var(--border-hairline);
  background-color: var(--bg-canvas);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px clamp(24px, 3vw, 48px);
}

.fb-auth-box {
  width: 100%;
  max-width: 460px;
}

.fb-mobile-brand {
  display: none;
  justify-content: center;
  margin-bottom: 28px;
}

.fb-auth-heading {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.fb-form {
  display: flex;
  flex-direction: column;
}

.fb-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   4. CONTROLES REUTILIZABLES (INPUTS FLOATING LABEL, SELECTS Y BOTONES)
   ========================================================================== */
.fb-field {
  position: relative;
  width: 100%;
}

.fb-input {
  width: 100%;
  height: 54px;
  padding: 20px 16px 6px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.3;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fb-input--password {
  padding-inline-end: 48px;
}

.fb-input:hover {
  border-color: var(--border-input-hover);
}

.fb-input:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 1px var(--border-input-focus);
}

.fb-label {
  position: absolute;
  top: 50%;
  inset-inline-start: 16px;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  pointer-events: none;
  transform-origin: left top;
  transition: top 0.14s ease, transform 0.14s ease, font-size 0.14s ease, color 0.14s ease;
}

[dir="rtl"] .fb-label {
  transform-origin: right top;
}

.fb-input:focus + .fb-label,
.fb-input:not(:placeholder-shown) + .fb-label {
  top: 9px;
  transform: translateY(0);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.fb-input:focus + .fb-label {
  color: var(--border-input-focus);
}

.fb-pwd-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 12px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.fb-pwd-toggle:hover {
  background-color: #f2f4f7;
  color: var(--text-primary);
}

.fb-pwd-toggle.is-visible {
  display: inline-flex;
}

.fb-select-wrap {
  position: relative;
  width: 100%;
}

.fb-select {
  width: 100%;
  height: 54px;
  padding-inline-start: 16px;
  padding-inline-end: 40px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fb-select.is-empty {
  color: var(--text-secondary);
}

.fb-select:hover {
  border-color: var(--border-input-hover);
}

.fb-select:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 1px var(--border-input-focus);
}

.fb-select-chevron {
  position: absolute;
  top: 50%;
  inset-inline-end: 14px;
  transform: translateY(-50%);
  color: var(--text-primary);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fb-btn-primary,
.fb-btn-outline,
.fb-btn-neutral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.08s ease;
}

.fb-btn-primary {
  border: none;
  background-color: var(--brand-blue-btn);
  color: #ffffff;
}

.fb-btn-primary:hover {
  background-color: var(--brand-blue-btn-hover);
}

.fb-btn-primary:active {
  background-color: var(--brand-blue-btn-active);
  transform: scale(0.992);
}

.fb-btn-outline {
  border: 1px solid var(--brand-blue-btn);
  background-color: var(--bg-canvas);
  color: var(--brand-blue-btn);
  font-weight: 500;
}

.fb-btn-outline:hover {
  background-color: var(--brand-blue-tint);
}

.fb-btn-neutral {
  border: none;
  background-color: var(--bg-btn-neutral);
  color: var(--text-primary);
}

.fb-btn-neutral:hover {
  background-color: var(--bg-btn-neutral-hover);
}

.fb-btn-primary:focus-visible,
.fb-btn-outline:focus-visible,
.fb-btn-neutral:focus-visible,
.fb-back-btn:focus-visible,
.fb-help-btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.fb-login-submit {
  margin-top: 16px;
  font-weight: 500;
}

.fb-forgot-row {
  margin-top: 16px;
  text-align: center;
}

.fb-forgot-link {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.fb-forgot-link:hover {
  text-decoration: none;
  background-color: #f2f4f7;
}

.fb-secondary-block {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.fb-meta-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1c2b33;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  user-select: none;
}

/* ==========================================================================
   5. VISTA 2: CREAR CUENTA NUEVA (META ACCOUNT ONBOARDING)
   ========================================================================== */
.fb-signup-shell {
  flex: 1 0 auto;
  width: 100%;
  background-color: var(--bg-canvas);
  display: flex;
  justify-content: center;
  padding: 20px 20px 36px;
}

.fb-signup-card {
  width: 100%;
  max-width: 540px;
}

.fb-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-inline-start: -10px;
  margin-bottom: 10px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.fb-back-btn:hover {
  background-color: var(--bg-btn-neutral);
}

[dir="rtl"] .fb-back-btn svg {
  transform: scaleX(-1);
}

.fb-signup-header {
  margin-bottom: 20px;
}

.fb-signup-meta {
  margin-bottom: 10px;
}

.fb-signup-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.fb-signup-subtitle {
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--text-primary);
}

.fb-signup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fb-section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fb-section-header {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.fb-section-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.fb-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.fb-help-btn:hover {
  background-color: var(--bg-btn-neutral);
}

.fb-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  width: min(300px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-canvas);
  box-shadow: var(--shadow-popover);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-primary);
  z-index: 30;
}

.fb-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fb-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fb-helper-note {
  font-size: 13px;
  line-height: 1.42;
  color: var(--text-primary);
  margin-top: 2px;
}

.fb-inline-link {
  color: var(--brand-blue-btn);
  font-weight: 600;
}

.fb-legal-block {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.44;
  color: var(--text-primary);
}

.fb-signup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ==========================================================================
   6. FOOTER GLOBAL COMPARTIDO (SELECTOR DE IDIOMAS FUNCIONAL)
   ========================================================================== */
.fb-footer {
  width: 100%;
  border-top: 1px solid var(--border-hairline);
  background-color: var(--bg-canvas);
  padding: 20px 24px 28px;
}

.fb-footer--no-border {
  border-top: none;
  padding-top: 10px;
}

.fb-footer-inner {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-footer-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 14px;
  row-gap: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-footer);
}

.fb-lang-link[aria-current="true"] {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}

.fb-lang-link[aria-current="true"]:hover {
  text-decoration: none;
}

.fb-adchoices {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fb-more-langs {
  display: none;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 0 2px;
  border-top: 1px dashed var(--border-hairline);
  list-style: none;
  font-size: 11px;
  color: var(--text-footer);
}

.fb-more-langs.is-open {
  display: flex;
}

/* ==========================================================================
   7. ARQUITECTURA RESPONSIVE
   ========================================================================== */
@media (max-width: 1320px) {
  .fb-collage {
    transform: scale(0.86);
  }

  .fb-collage-slot {
    padding-inline-start: 120px;
  }
}

@media (max-width: 1120px) {
  :root {
    --right-pane-width: 390px;
  }

  .fb-collage {
    transform: scale(0.72);
  }

  .fb-collage-slot {
    padding-inline-start: 100px;
  }
}

@media (max-width: 900px) {
  .fb-shell {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 140px);
  }

  .fb-stage {
    display: none;
  }

  .fb-auth-pane {
    border-inline-start: none;
    padding: 48px 20px 44px;
    justify-content: center;
  }

  .fb-auth-box {
    max-width: 400px;
  }

  .fb-mobile-brand {
    display: flex;
  }

  .fb-auth-heading {
    text-align: center;
    margin-bottom: 20px;
  }
}

@media (max-width: 520px) {
  .fb-auth-pane {
    padding: 32px 16px 36px;
    justify-content: flex-start;
  }

  .fb-mobile-brand {
    margin-top: 16px;
    margin-bottom: 24px;
  }

  .fb-secondary-block {
    margin-top: 36px;
  }

  .fb-signup-shell {
    padding: 16px 16px 28px;
  }

  .fb-signup-title {
    font-size: 22px;
  }

  .fb-grid-2,
  .fb-grid-3 {
    gap: 8px;
  }

  .fb-select {
    padding-inline-start: 12px;
    padding-inline-end: 32px;
    font-size: 14px;
  }

  .fb-footer {
    padding: 18px 16px 24px;
  }

  .fb-footer-row {
    column-gap: 10px;
  }
}