@import url("/ui-fixds.css");
@import url("/styles/home/public-home.css");
@import url("/styles/explore/explore-hub.css");

/* Responsive fixes loaded by public/index.html.
   This file intentionally sits after the main bundle so we can patch
   mobile layout issues without editing minified CSS. */

/* ── Hero: badge de lanzamiento (reemplaza contadores cuando hay < 50 usuarios) ── */
.hero-launch-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  padding: 10px 20px;
  background: rgba(74, 154, 168, 0.12);
  border: 1px solid rgba(74, 154, 168, 0.35);
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--accent2);
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

/* Home: compuerta de acceso sin superposición visual */
.landing-section--preview .preview-showcase {
  isolation: isolate;
}

.landing-section--preview .preview-surface {
  position: relative;
  overflow: hidden;
}

body:not(.is-authenticated) .landing-section--preview .preview-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(248, 79, 118, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(8, 14, 28, 0.5), rgba(8, 14, 28, 0.76));
  pointer-events: none;
}

body:not(.is-authenticated) .landing-section--preview .preview-surface-body.is-blurred {
  filter: blur(12px);
  opacity: 0.22;
  transform: scale(0.98);
}

.landing-section--preview .preview-lock-panel {
  z-index: 5;
  width: min(540px, calc(100% - 48px));
  padding: clamp(24px, 3vw, 34px);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(28, 38, 68, 0.99) 0%, rgba(24, 36, 64, 0.99) 52%, rgba(16, 26, 49, 0.99) 100%);
  border: 1px solid rgba(248, 79, 118, 0.34);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: none;
}

.landing-section--preview .preview-lock-panel h3 {
  max-width: 32ch;
  margin-inline: auto;
  font-size: clamp(1.28rem, 2vw, 1.6rem);
  line-height: 1.14;
}

.landing-section--preview .preview-lock-panel p {
  max-width: 52ch;
  margin-inline: auto;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.55;
}

.landing-section--preview .preview-lock-actions {
  align-items: center;
}

.landing-section--preview .preview-lock-list {
  max-width: 500px;
  margin-inline: auto;
}

.landing-section--preview .preview-lock-chip {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

@media (max-width: 980px) {
  .landing-section--preview .preview-lock-panel {
    position: relative;
    inset: auto;
    width: 100%;
    margin-top: 18px;
    transform: none;
  }
}

@media (max-width: 640px) {
  .landing-section--preview .preview-lock-panel {
    padding: 22px 18px;
  }

  .landing-section--preview .preview-lock-list {
    justify-content: center;
  }
}

/* Destinos: recomendador en ventana emergente */
body.migration-modal-open {
  overflow: hidden;
}

#view-explorar #countries-grid-wrap[hidden],
#view-explorar #country-detail[hidden],
#view-explorar #migration-results-shell,
#view-explorar #pathway-spotlight {
  display: none !important;
}

.migration-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 5000 !important;
  display: grid !important;
  place-items: center !important;
  padding: clamp(14px, 3vw, 32px) !important;
}

.migration-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 28, 0.76);
  backdrop-filter: blur(12px);
}

.migration-modal__panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 48px));
  max-height: min(86vh, 860px);
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(248, 79, 118, 0.22);
  background: #182645;
  color: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.migration-modal__topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 4px;
}

.migration-modal__topbar h3,
.migration-modal-cta h4,
.migration-modal__section h4,
.migration-modal-category h5,
.migration-modal-route h4 {
  margin: 0;
}

.migration-modal__topbar h3 {
  margin-top: 8px;
  font-size: clamp(1.28rem, 2.2vw, 1.8rem);
  line-height: 1.12;
}

.migration-modal__topbar p,
.migration-modal-cta p,
.migration-modal-route p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.58;
}

.migration-modal__close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.migration-modal__summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.migration-modal__summary div,
.migration-modal-route,
.migration-modal-cta,
.migration-modal-category {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.38);
}

.migration-modal__summary div {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 10px;
}

.migration-modal__summary span,
.migration-modal-route__top {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.migration-modal__summary strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.migration-modal__section {
  display: grid;
  gap: 10px;
}

.migration-modal__section h4,
.migration-modal-cta h4 {
  font-size: 1.08rem;
  line-height: 1.2;
}

.migration-modal__recommendations,
.migration-modal__compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.migration-modal-category {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
}

.migration-modal-category h5 {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
}

.migration-modal-route {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
}

.migration-modal-route--eligible {
  border-color: rgba(248, 79, 118, 0.34);
  background: rgba(248, 79, 118, 0.1);
}

.migration-modal-route--limited,
.migration-modal-route--alternative {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

.migration-modal-route--blocked {
  opacity: 0.78;
}

.migration-modal-route__top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  letter-spacing: 0;
  text-transform: none;
}

.migration-modal-route__status,
.migration-modal-route__type {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.75rem;
  font-weight: 700;
}

.migration-modal-route__status {
  color: #fff;
  border-color: rgba(248, 79, 118, 0.32);
  background: rgba(248, 79, 118, 0.16);
}

.migration-modal-route h4 {
  font-size: 0.98rem;
  line-height: 1.3;
}

.migration-modal-route__notes {
  display: grid;
  gap: 6px;
}

.migration-modal-route__notes p,
.migration-modal-route p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.9rem;
  line-height: 1.5;
}

.migration-modal-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(248, 79, 118, 0.22), rgba(25, 31, 56, 0.86));
}

.migration-modal-cta .btn {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .migration-modal__summary,
  .migration-modal__recommendations,
  .migration-modal__compact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .migration-modal {
    align-items: end !important;
    padding: 0 !important;
  }

  .migration-modal__panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
  }

  .migration-modal__topbar,
  .migration-modal-cta {
    display: grid;
  }

  .migration-modal__summary,
  .migration-modal__recommendations,
  .migration-modal__compact-grid {
    grid-template-columns: 1fr;
  }

  .migration-modal-cta .btn {
    width: 100%;
  }
}

.hero-launch-badge .hero-launch-icon {
  font-size: 1.1rem;
}

.hero-launch-badge .hero-launch-sep {
  color: var(--muted);
}

.hero-launch-badge strong {
  color: var(--text);
}

/* ── Mapa: empty state mejorado ── */
#mapa-empty .empty-state-icon {
  font-size: 3.5rem;
}

#mapa-empty .empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
}

#auth-modal {
  z-index: 1300;
}

.leaflet-container {
  background: #d9e6f2;
}

.leaflet-container img,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}

#profile-edit-modal {
  z-index: 1100;
}

#view-herramientas {
  width: min(100%, 1040px);
  max-width: 1040px;
}

.tools-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  padding: 6px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  overflow: visible;
}

.tools-tabs .tool-tab {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

.tool-panel {
  min-width: 0;
}

.tool-panel .calc-form,
.tool-panel .budget-result,
.tool-panel .checklist-progress {
  width: 100%;
  min-width: 0;
}

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

.eligibility-tool__grid .form-group,
.eligibility-tool__grid input,
.eligibility-tool__grid select {
  min-width: 0;
}

.eligibility-tool__result {
  margin-top: 18px;
}

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

.budget-breakdown {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.budget-item {
  min-width: 0;
}

.budget-item-value {
  overflow-wrap: anywhere;
}

.first30-country-card,
.alert-country-card,
.checklist-item {
  min-width: 0;
}

.first30-country-card .info,
.alert-country-card .country-info > div,
.checklist-label {
  min-width: 0;
}

.official-source-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.official-source-actions a {
  color: var(--accent2);
  font-size: 0.82rem;
  font-weight: 700;
}

.official-source-panel {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.official-source-panel.is-error {
  border-left-color: var(--red);
}

.official-source-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.official-source-text,
.official-source-panel li {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.official-source-panel ul {
  margin: 6px 0 0 18px;
}

.profile-edit-modal-box {
  max-width: 760px;
  max-height: min(92vh, 920px);
  overflow-y: auto;
}

.profile-edit-modal-box .profile-edit-form {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.profile-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.profile-edit-actions .btn {
  flex: 1 1 0;
}

@media (max-width: 900px) {
  #app-nav {
    gap: 10px;
  }

  #view-inicio {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero-shell {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-copy-panel,
  .landing-section-head {
    max-width: none;
  }

  .hero-media-frame {
    min-height: 460px;
  }

  .landing-sections {
    gap: 20px;
  }

  .feed-composer-bottom,
  .thread-detail-summary,
  .profile-top {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .profile-actions .btn {
    flex: 1 1 180px;
  }

  .reply-form,
  .calc-form,
  .budget-result,
  .checklist-progress {
    padding: 18px;
  }

  .tools-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .eligibility-tool__grid,
  .eligibility-tool__grid-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .budget-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thread-votes {
    flex-direction: row;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  :root {
    --nav-h: 64px;
  }

  #app-nav {
    height: var(--nav-h);
    padding-left: 12px;
    padding-right: 12px;
  }

  #app-nav .nav-links {
    gap: 10px;
  }

  #app-nav .nav-group {
    min-width: 0;
    width: 100%;
    padding: 8px;
    gap: 8px;
  }

  #app-nav .nav-group + .nav-group {
    padding-left: 8px;
    border-left: none;
  }

  #app-nav .nav-group-label {
    padding-left: 6px;
    padding-right: 6px;
  }

  #app-nav .nav-link,
  #app-nav .nav-dropdown__trigger {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .nav-logo-image {
    max-width: 148px;
  }

  .nav-right {
    flex-shrink: 0;
  }

  #nav-auth-area .btn {
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
  }

  .nav-links {
    top: var(--nav-h);
    left: 8px;
    right: 8px;
    max-height: calc(100dvh - var(--nav-h) - 16px);
    overflow-y: auto;
  }

  .nav-link-set--internal {
    gap: 8px;
  }

  #view-feed,
  #view-explorar,
  #view-herramientas,
  #view-foro,
  #view-match,
  #view-perfil,
  #view-chat,
  #view-mapa,
  #view-admin,
  #view-visas {
    padding-left: 14px;
    padding-right: 14px;
  }

  #view-inicio {
    padding: 24px 14px 40px;
  }

  .hero-title {
    max-width: none;
    font-size: clamp(1.95rem, 9vw, 2.7rem);
  }

  .hero-sub,
  .hero-kicker {
    max-width: none;
  }

  .hero-cta,
  .hero-stats {
    width: 100%;
  }

  .hero-media-frame {
    min-height: 360px;
    border-radius: 22px;
  }

  .hero-media-copy {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .hero-media-copy p {
    max-width: none;
    font-size: 1.08rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .hero-stat {
    padding: 6px 2px;
  }

  .landing-section {
    padding: 22px 16px;
    border-radius: 22px;
  }

  .landing-section-head h2 {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .feed-composer-top,
  .comment-form,
  .chat-input-row,
  .profile-edit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .feed-composer-meta,
  .modal-actions,
  .public-final-actions {
    width: 100%;
  }

  .feed-composer-bottom,
  .modal-actions,
  .chat-input-row,
  .thread-detail-summary {
    gap: 10px;
  }

  .feed-composer-bottom .btn,
  .comment-form button,
  .modal-actions .btn,
  .chat-input-row .btn {
    width: 100%;
  }

  .checklist-progress {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-text {
    white-space: normal;
    text-align: center;
  }

  .foro-cats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .foro-cat {
    width: 100%;
    text-align: center;
  }

  .budget-breakdown,
  .country-info-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .thread-card-layout,
  .thread-top,
  .admin-header,
  .admin-item {
    flex-direction: column;
    align-items: stretch;
  }

  .thread-badges,
  .admin-actions {
    justify-content: flex-start;
  }

  .profile-cover {
    height: 180px;
  }

  .profile-stats {
    gap: 14px;
    justify-content: space-between;
  }

  .profile-stat {
    flex: 1 1 30%;
    min-width: 86px;
  }

  .visited-row,
  .vr-dates {
    flex-direction: column;
    align-items: stretch;
  }

  .visited-row > * {
    width: 100%;
  }

  .chat-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - 140px);
  }

  .chat-sidebar {
    width: 100%;
    min-width: 0;
    max-height: 34dvh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chat-thread {
    min-height: 52dvh;
  }

  .chat-msg {
    max-width: 88%;
  }

  .mapa-container {
    height: 420px;
  }
}

@media (max-width: 560px) {
  .tools-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .foro-cats {
    grid-template-columns: 1fr;
  }

  .eligibility-tool__grid,
  .eligibility-tool__grid-results,
  .budget-breakdown {
    grid-template-columns: 1fr;
  }

  .profile-header,
  .thread-card,
  .reply-card,
  .feed-composer,
  .calc-form,
  .budget-result,
  .profile-edit-form,
  .reply-form {
    padding: 16px;
  }

  .post-actions {
    grid-template-columns: 1fr;
  }

  .post-action-btn {
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
  }

  .profile-name {
    font-size: 1.2rem;
  }

  .profile-cover {
    height: 148px;
  }

  #app-nav .nav-links {
    left: 6px;
    right: 6px;
    max-height: calc(100dvh - var(--nav-h) - 12px);
    padding: 10px;
  }

  #view-inicio {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-topline {
    margin-bottom: 14px;
  }

  .hero-title {
    font-size: clamp(1.75rem, 8.4vw, 2.2rem);
  }

  .hero-kicker {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .hero-media-frame {
    min-height: 300px;
    border-radius: 18px;
  }

  .profile-edit-modal-box {
    max-height: calc(100dvh - 24px);
    padding: 20px 16px 16px;
  }

  .landing-section {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .match-layout {
    gap: 14px;
  }

  .match-card,
  .country-card {
    padding: 16px;
  }

  .mapa-container {
    height: 340px;
  }
}

@media (max-width: 420px) {
  #view-feed,
  #view-explorar,
  #view-herramientas,
  #view-foro,
  #view-match,
  #view-perfil,
  #view-chat,
  #view-mapa,
  #view-admin,
  #view-visas {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nav-logo-image {
    max-width: 136px;
  }

  #app-nav .nav-group-label {
    font-size: 0.58rem;
    letter-spacing: 0.14em;
  }

  #nav-auth-area .btn {
    font-size: 0.78rem;
    padding-left: 10px;
    padding-right: 10px;
  }

  .modal-box,
  .modal-box--wide {
    width: 100%;
    max-width: none;
  }

  .profile-stats {
    gap: 10px;
  }

  .profile-stat {
    flex-basis: 45%;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-thread-header,
  .chat-input-row {
    padding-left: 12px;
    padding-right: 12px;
  }
}
