/* ============================================================
   kp-ui.css — Diálogos, contacto anónimo, estados de revisión,
   ajustes del perfil y barra inferior. Estilo plano y moderno.
   ============================================================ */
:root {
  --ui-accent: #E11D48; --ui-ink: #18181B; --ui-muted: #71717A;
  --ui-line: #ECECEE; --ui-bg: #F4F4F5; --ui-card: #FFFFFF;
}
body.dark-theme {
  --ui-accent: #FB7185; --ui-ink: #F4F4F5; --ui-muted: #A1A1AA;
  --ui-line: #27272A; --ui-bg: #1F1F23; --ui-card: #141416;
}

/* ── Diálogo base ── */
.kp-dlg { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.kp-dlg-backdrop { position: absolute; inset: 0; background: rgba(9, 9, 11, .55); opacity: 0; transition: opacity .2s ease; }
.kp-dlg-card {
  position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 22px 20px 18px; border-radius: 18px; background: var(--ui-card); color: var(--ui-ink);
  border: 1px solid var(--ui-line); box-shadow: 0 20px 50px rgba(0,0,0,.25);
  transform: translateY(12px) scale(.98); opacity: 0; transition: transform .2s ease, opacity .2s ease;
}
.kp-dlg.is-open .kp-dlg-backdrop { opacity: 1; }
.kp-dlg.is-open .kp-dlg-card { transform: none; opacity: 1; }
.kp-dlg-title { margin: 0 0 6px; font-size: 1.08rem; font-weight: 700; color: var(--ui-ink); }
.kp-dlg-sub { margin: 0; font-size: .8rem; color: var(--ui-muted); }
.kp-dlg-text { margin: 0 0 4px; font-size: .92rem; line-height: 1.5; color: var(--ui-muted); }
.kp-dlg-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--ui-bg); color: var(--ui-muted); font-size: .84rem; }
.kp-dlg-input {
  width: 100%; box-sizing: border-box; margin-top: 14px; padding: 12px 14px; resize: vertical;
  border-radius: 12px; border: 1px solid var(--ui-line); background: var(--ui-bg); color: var(--ui-ink);
  font: inherit; font-size: 16px; line-height: 1.45; outline: none;
}
.kp-dlg-input:focus { border-color: var(--ui-ink); background: var(--ui-card); }
.kp-dlg-actions { display: flex; gap: 8px; margin-top: 18px; }
.kp-dlg-actions.kp-dlg-col { flex-direction: column; }
.kp-dlg-btn {
  flex: 1; height: 46px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-ink);
  font-family: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
}
.kp-dlg-btn:disabled { opacity: .45; cursor: not-allowed; }
.kp-dlg-btn.is-primary { background: var(--ui-ink); color: var(--ui-card); border-color: var(--ui-ink); }
.kp-dlg-btn.is-danger { background: #DC2626; color: #fff; border-color: #DC2626; }
@media (max-width: 560px) {
  .kp-dlg { align-items: flex-end; padding: 0; }
  .kp-dlg-card { width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); }
}

/* ── Contacto anónimo ── */
.kp-anon-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.kp-anon-head .kp-dlg-title { margin: 0 0 2px; }
.kp-anon-ico { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: #EDE9FE; color: #6D28D9; }
body.dark-theme .kp-anon-ico { background: rgba(139, 92, 246, .16); color: #C4B5FD; }
.kp-anon-quote { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--ui-line); background: var(--ui-bg); border-radius: 0 10px 10px 0; color: var(--ui-ink); font-size: .88rem; line-height: 1.5; }
.kp-anon-steps { margin: 0; padding-left: 18px; color: var(--ui-muted); font-size: .84rem; line-height: 1.5; }
.kp-anon-steps li + li { margin-top: 4px; }
.kp-anon-count { text-align: right; font-size: .72rem; color: var(--ui-muted); margin-top: 4px; }
/* El modal viejo ya no se usa */
#anonContactModal { display: none !important; }

/* ── Toast ── */
.kp-toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 100001;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--ui-ink); color: var(--ui-card); font-size: .88rem; font-weight: 500;
  transition: opacity .2s ease, transform .2s ease;
}
.kp-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Publicación en revisión ── */
.kp-review-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px;
  background: #FEF3C7; color: #92400E; font-size: .7rem; font-weight: 600;
}
.kp-review-tag.is-rejected { background: #FEE2E2; color: #991B1B; }
body.dark-theme .kp-review-tag { background: rgba(245, 158, 11, .15); color: #FCD34D; }
body.dark-theme .kp-review-tag.is-rejected { background: rgba(239, 68, 68, .15); color: #FCA5A5; }

/* ── @usuario en el perfil ── */
.kp-handle { color: var(--ui-muted) !important; font-weight: 500 !important; }
.kp-handle b { color: var(--ui-ink); font-weight: 600; }

/* ── Ajustes del perfil ── */
.kp-settings-btn {
  position: absolute; top: 14px; left: 14px; z-index: 5; height: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; border: 0; cursor: pointer;
  background: rgba(24, 24, 27, .62); color: #fff; font-family: inherit; font-weight: 600; font-size: .8rem; line-height: 1; backdrop-filter: blur(8px);
}
.kp-set-group { margin-top: 16px; }
.kp-set-label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 600; color: var(--ui-muted); }
.kp-set-field { position: relative; }
.kp-set-field .kp-at { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ui-muted); font-weight: 600; }
.kp-set-input {
  width: 100%; box-sizing: border-box; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--ui-line); background: var(--ui-bg); color: var(--ui-ink); font: inherit; font-size: 16px; outline: none;
}
.kp-set-field .kp-set-input { padding-left: 30px; }
textarea.kp-set-input { height: auto; padding: 12px 14px; resize: vertical; }
.kp-set-input:focus { border-color: var(--ui-ink); background: var(--ui-card); }
.kp-set-hint { margin-top: 5px; font-size: .76rem; color: var(--ui-muted); min-height: 1em; }
.kp-set-hint.is-ok { color: #15803D; }
.kp-set-hint.is-bad { color: #DC2626; }
.kp-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--ui-line); }
.kp-switch-row:first-of-type { border-top: 0; }
.kp-switch-text { display: flex; flex-direction: column; gap: 2px; }
.kp-switch-text strong { font-size: .9rem; color: var(--ui-ink); }
.kp-switch-text span { font-size: .78rem; color: var(--ui-muted); line-height: 1.4; }
.kp-switch { position: relative; flex: 0 0 auto; width: 44px; height: 26px; }
.kp-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.kp-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--ui-line); transition: background .2s ease; }
.kp-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s ease; }
.kp-switch input:checked + i { background: var(--ui-ink); }
.kp-switch input:checked + i::after { transform: translateX(18px); }
.kp-set-notice { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--ui-bg); color: var(--ui-muted); font-size: .8rem; line-height: 1.45; }

/* ── Barra inferior v2 ── */
.kp-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(62px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: var(--ui-card); border-top: 1px solid var(--ui-line);
}
.kp-tab {
  position: relative; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--ui-muted); text-decoration: none; cursor: pointer;
  font-family: inherit; font-weight: 500; font-size: .68rem; line-height: 1; -webkit-tap-highlight-color: transparent;
}
.kp-tab svg { width: 24px; height: 24px; }
.kp-tab.is-active { color: var(--ui-ink); font-weight: 600; }
.kp-tab.is-active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--ui-accent); }
.kp-tab .kp-tab-dot { position: absolute; top: 10px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--ui-accent); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--ui-card); }
.kp-tab-create .kp-tab-plus {
  width: 46px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ui-ink); color: var(--ui-card);
}
.kp-tab-create .kp-tab-plus svg { width: 22px; height: 22px; }
.kp-tab-create { color: var(--ui-ink); }
@media (min-width: 900px) { .kp-tabbar { display: none; } }
body.has-kp-tabbar .bottom-nav { display: none !important; }
@media (max-width: 899px) { body.has-kp-tabbar { padding-bottom: calc(62px + env(safe-area-inset-bottom)); } }

/* Hoja "Crear" */
.kp-create-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.kp-create-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-ink); font: inherit; text-decoration: none;
}
.kp-create-item:hover { background: var(--ui-bg); }
.kp-create-ico { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--ui-bg); color: var(--ui-ink); }
.kp-create-item strong { display: block; font-size: .94rem; }
.kp-create-item span { display: block; font-size: .78rem; color: var(--ui-muted); margin-top: 2px; }
.kp-tab .kp-tab-dot[hidden] { display: none !important; }
.kp-tab span { font-size: .68rem; }
.kp-tab .kp-tab-plus + span { margin-top: 1px; }

/* ── Barra inferior v3: colores de la marca ── */
.kp-tabbar {
  height: calc(64px + env(safe-area-inset-bottom)) !important;
  background: rgba(255, 255, 255, .96) !important;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid rgba(225, 29, 72, .10) !important;
  align-items: center !important;
}
body.dark-theme .kp-tabbar { background: rgba(18, 10, 16, .94) !important; border-top-color: rgba(251, 113, 133, .14) !important; }
.kp-tab { height: 64px !important; color: #8B8190 !important; gap: 4px !important; }
.kp-tab svg { width: 25px !important; height: 25px !important; transition: transform .18s ease; }
.kp-tab span { font-size: .68rem !important; font-weight: 500; letter-spacing: .01em; }
.kp-tab.is-active { color: #E11D48 !important; }
.kp-tab.is-active span { font-weight: 700; }
.kp-tab.is-active svg { transform: translateY(-1px); }
.kp-tab.is-active::before {
  top: auto !important; bottom: 7px !important; left: calc(50% - 3px) !important; right: auto !important;
  width: 6px !important; height: 6px !important; border-radius: 50% !important; background: #E11D48 !important;
  display: none;
}
body.dark-theme .kp-tab { color: #A1A1AA !important; }
body.dark-theme .kp-tab.is-active { color: #FB7185 !important; }
.kp-tab-create { align-self: center; }
.kp-tab-create .kp-tab-plus {
  width: 52px !important; height: 40px !important; border-radius: 14px !important;
  background: #E11D48 !important; color: #fff !important;
  box-shadow: 0 6px 16px rgba(225, 29, 72, .28);
  transition: transform .15s ease, background .15s ease;
}
.kp-tab-create:active .kp-tab-plus { transform: scale(.94); background: #BE123C !important; }
.kp-tab-create .kp-tab-plus svg { width: 24px !important; height: 24px !important; }
.kp-tab .kp-tab-dot { top: 9px !important; background: #E11D48 !important; }
.kp-create-ico { background: #FFF1F3 !important; color: #E11D48 !important; }
body.dark-theme .kp-create-ico { background: rgba(251, 113, 133, .12) !important; color: #FB7185 !important; }
.kp-attn { outline: 2px solid #E11D48; outline-offset: 2px; border-radius: 12px; }

/* ── Reels: miniaturas en muro y perfil ── */
.kp-reel-media { background: #000 !important; }
.kp-reel-thumb { position: relative; display: block; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 9 / 16; max-height: 560px; overflow: hidden; border-radius: 14px; background: #111; }
.kp-reel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kp-reel-noposter { position: absolute; inset: 0; background: linear-gradient(160deg, #2a0f1f, #0b0b0f); }
.kp-reel-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.kp-reel-play svg { width: 62px; height: 62px; padding: 16px; border-radius: 50%; background: rgba(0,0,0,.45); box-sizing: border-box; }
.kp-reel-label { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: .74rem; font-weight: 600; }
.kp-reels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 640px) { .kp-reels-grid { gap: 8px; } }
.kp-reel-cell { position: relative; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: #111; display: block; }
.kp-reel-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kp-reel-cell-play { position: absolute; left: 8px; bottom: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.kp-reel-tag { position: absolute; top: 6px; left: 6px; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .64rem; font-weight: 600; }
.kp-reel-tag.is-wait { background: #FEF3C7; color: #92400E; }
.kp-reel-tag.is-anon { background: #6D28D9; }
.kp-reel-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--ui-bg); color: var(--ui-muted); border: 1.5px dashed var(--ui-line); text-decoration: none; font-size: .78rem; font-weight: 600; }

/* ── Ambiente: etiqueta y filtro ── */
.kp-vibe-tag {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px;
  padding: 4px 10px; border-radius: 999px; background: #FFF1F3; color: #BE123C;
  font-size: .78rem; font-weight: 600;
}
body.dark-theme .kp-vibe-tag { background: rgba(251, 113, 133, .12); color: #FDA4AF; }
.kp-vibe-filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; }
.kp-vibe-filter::-webkit-scrollbar { display: none; }
.kp-vibe-filter button {
  flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-ink);
  font-family: inherit; font-size: .84rem; font-weight: 500;
}
.kp-vibe-filter button.is-on { background: #E11D48; border-color: #E11D48; color: #fff; }

.kp-post-vibe-badge { display: inline-flex !important; align-items: center; gap: 6px; padding: 4px 10px !important; border-radius: 999px !important; background: #FFF1F3 !important; color: #BE123C !important; border: 0 !important; box-shadow: none !important; font-size: .78rem !important; font-weight: 600 !important; }
body.dark-theme .kp-post-vibe-badge { background: rgba(251, 113, 133, .12) !important; color: #FDA4AF !important; }
