/**
 * STAR — UI coherente: espaciado, botones e iconos responsive.
 * Carga al final del pack star / junto a star-card.
 */

/* Evitar scrollbar horizontal en Windows (100vw + sombra de la tarjeta) */
html:has(body.page-star),
body.page-star {
  overflow-x: hidden;
  max-width: 100%;
}

body.page-star .main-container,
body.page-feed.page-star .main-container {
  max-width: 100%;
  width: min(1440px, calc(100% - 24px));
  box-sizing: border-box;
  overflow-x: clip;
}

/* —— Columna principal: aire entre bloques —— */
body.page-star .center-column,
body.page-feed.page-star .center-column {
  padding: 0.85rem 1.15rem 1.25rem !important;
  box-sizing: border-box !important;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

body.page-star .star-page {
  width: 100%;
  padding-bottom: calc(var(--bottom-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 1.25rem);
}

body.page-star .star-home-grid {
  display: grid;
  gap: 1.15rem;
  width: 100%;
}

body.page-star .center-column > .star-panel,
body.page-star .center-column > .star-card,
body.page-star .center-column > .star-ad-slot {
  margin-bottom: 0;
}

body.page-star .star-panel {
  padding: 1.1rem 1.15rem;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.06);
}

body.page-star .star-panel + .star-panel,
body.page-star .star-card + .star-panel,
body.page-star .star-panel + .star-ad-slot {
  /* el gap del grid ya separa; refuerzo en stacks sin grid */
}

body.page-star .star-empty {
  margin: 0.35rem 0 0.9rem;
  line-height: 1.45;
  font-size: 0.9rem;
}

/* —— Botones / CTAs —— */
body.page-star .star-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

body.page-star .star-cta,
body.page-star .auth-submit,
body.page-star .btn-primary,
body.page-star button.auth-submit,
body.page-landing .auth-submit,
body.page-landing .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0.65rem 1.15rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  max-width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.page-star .star-cta--primary,
body.page-star .auth-submit,
body.page-star .btn-primary,
body.page-landing .auth-submit,
body.page-landing .btn-primary {
  color: #fff !important;
  background: linear-gradient(135deg, #1d4ed8, #2563eb 55%, #38bdf8) !important;
  border: 1px solid #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

body.page-star .star-cta--ghost {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfd0e8 !important;
  box-shadow: none;
}

body.page-star .star-cta i,
body.page-star .auth-submit i,
body.page-star .btn-primary i {
  font-size: 0.95em;
  line-height: 1;
  flex-shrink: 0;
}

/* En móvil: CTAs a ancho completo, uno debajo de otro */
@media (max-width: 520px) {
  body.page-star .star-cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  body.page-star .star-cta,
  body.page-star .star-skills-save .auth-submit,
  body.page-star .auth-form .auth-submit {
    width: 100%;
    white-space: normal;
  }

  body.page-star .navbar-brand--star {
    letter-spacing: 0.12em;
    font-size: 0.95rem;
  }
}

/* Formularios skills / auth */
body.page-star .auth-label,
body.page-star .star-skills-filters .auth-label,
body.page-star .star-skills-save .auth-label {
  display: block;
  margin: 0.35rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

body.page-star .star-skills-filters,
body.page-star .star-skills-save {
  gap: 0.7rem;
}

body.page-star .star-skills-filters select,
body.page-star .star-skills-save select,
body.page-star .star-skills-save input[type="text"],
body.page-star .star-skills-save input[type="file"],
body.page-star .auth-form select,
body.page-star .auth-form input {
  min-height: 46px;
  font-size: 1rem; /* evita zoom iOS */
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
}

body.page-star .star-skills-save .auth-submit {
  margin-top: 0.35rem;
  width: 100%;
}

/* —— Bottom nav: icono + texto legibles —— */
body.page-star .bottom-nav-bar,
body.page-feed.page-star .bottom-nav-bar {
  height: auto !important;
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px)) !important;
  gap: 0.15rem;
  align-items: stretch !important;
  justify-content: space-around !important;
  box-sizing: border-box;
  /* 100vw en Windows incluye el ancho de la barra vertical → overflow lateral */
  width: 100% !important;
  max-width: 100% !important;
  left: 0;
  right: 0;
}

body.page-star .bottom-nav-icon,
body.page-feed.page-star .bottom-nav-icon {
  flex: 1 1 0;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 52px !important;
  height: auto !important;
  padding: 0.3rem 0.2rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.2rem;
  text-decoration: none;
  color: #64748b;
  border-radius: 10px;
  box-sizing: border-box;
}

body.page-star .bottom-nav-icon i {
  font-size: 1.15rem !important;
  line-height: 1 !important;
  width: auto !important;
  height: auto !important;
  display: block;
}

body.page-star .bottom-nav-label {
  display: block !important;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

body.page-star .bottom-nav-icon.active,
body.page-star .bottom-nav-icon[aria-current="page"] {
  color: #1d4ed8 !important;
  background: #eff6ff;
}

body.page-star .bottom-nav-icon--avatar .bottom-nav-avatar {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #bfd0e8;
}

body.page-star .bottom-nav-icon--avatar.active .bottom-nav-avatar {
  border-color: #2563eb;
}

/* Muy estrecho: solo iconos, texto más corto */
@media (max-width: 380px) {
  body.page-star .bottom-nav-label {
    font-size: 0.55rem;
    letter-spacing: 0;
  }

  body.page-star .bottom-nav-icon {
    padding: 0.25rem 0.1rem !important;
  }

  body.page-star .bottom-nav-icon i {
    font-size: 1.05rem !important;
  }
}

/* Header: iconos y marca sin aplastarse */
body.page-star .navbar {
  padding-inline: 0.65rem !important;
  gap: 0.5rem;
}

body.page-star .navbar .search-bar {
  min-width: 0;
  flex: 1 1 auto;
}

body.page-star .roll-header-icon,
body.page-star .navbar .roll-header-icon,
body.page-star a.roll-header-icon {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  background: #eef4ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfd0e8 !important;
  flex-shrink: 0;
}

body.page-star .roll-header-icon i {
  font-size: 1rem !important;
  line-height: 1;
}

/* Skills panel: bloques internos con aire */
body.page-star .page-star-skills .star-panel,
body.page-star-skills .star-panel {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

body.page-star .star-skills-current {
  margin: 0.75rem 0 0.25rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #d7e3f4;
}

body.page-star .star-skills-history {
  margin-top: 1.35rem;
}

body.page-star .star-progress {
  margin-bottom: 0.35rem;
}

/* Tarjeta en home: no pegada a los paneles */
body.page-star .star-card--compact {
  margin-bottom: 0;
}

@media (min-width: 720px) {
  body.page-star .star-home-grid {
    gap: 1.35rem;
  }

  body.page-star .center-column {
    padding: 1.15rem 1rem 1.5rem !important;
  }
}

/* —— Perfil (misma línea visual que home) —— */
body.page-star-perfil .star-perfil-avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

body.page-star-perfil .star-perfil-avatar {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid #bfd0e8;
  background: #eef4ff;
  flex-shrink: 0;
}

body.page-star-perfil .star-perfil-meta {
  min-width: 0;
  flex: 1 1 auto;
}

body.page-star-perfil .star-perfil-name {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  line-height: 1.2;
}

body.page-star-perfil .star-perfil-line {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text-soft, #334155);
  line-height: 1.35;
}

body.page-star-perfil .star-perfil-bio {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border, #d7e3f4);
}

body.page-star-perfil .star-cta--danger {
  background: #fff5f5 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
}

body.page-star-perfil .center-column {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Home: 3 botones en la misma línea, uniformes */
body.page-star-home .center-column {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Contener la sombra de la carta para que no empuje el scroll horizontal */
body.page-star-home .center-column > .star-card {
  max-width: 100%;
  box-shadow: 0 10px 24px rgba(28, 25, 20, 0.16);
}

body.page-star-home .star-home-actions {
  padding: 0.85rem;
}

body.page-star-home .star-cta-row--triple {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  flex-direction: row !important;
  align-items: stretch;
}

body.page-star-home .star-cta-row--triple .star-cta {
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.4rem;
  white-space: normal;
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.2;
}

body.page-star-home .star-cta-row--triple .star-cta i {
  font-size: 1.05rem;
}

body.page-star-home .star-cta-row--triple .star-cta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 380px) {
  body.page-star-home .star-cta-row--triple .star-cta {
    font-size: 0.7rem;
    padding: 0.6rem 0.25rem;
  }
}
