/* ===================================================================
   Vizu — app (feed, mensajes, perfil, campaña, sesión)
   Tokens alineados con css/home.css y design-system/vizu/MASTER.md.
=================================================================== */

:root {
  --bg: #121212;
  --surface: #2C2C2E;
  --surface-alt: #161617;
  --accent: #E34234;
  --on-accent: #FFFFFF;
  --fg: #F1F3F4;
  --success: #6FCF97;
  --border: rgba(255,255,255,0.08);
  --fg-70: rgba(241,243,244,0.7);
  --fg-62: rgba(241,243,244,0.62);
  --fg-50: rgba(241,243,244,0.6);

  --font-h: 'Space Grotesk', sans-serif;
  --font-b: Inter, system-ui, sans-serif;

  --r: 8px;
  --r-card: 12px;
  --tabbar-height: 60px;
  --topbar-height: 52px;

  --shadow-md: 0 4px 6px rgba(0,0,0,0.24);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-b);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--tabbar-height);
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

h1, h2, h3 { font-family: var(--font-h); margin: 0 0 0.5em; letter-spacing: -0.02em; }

ul { list-style: none; margin: 0; padding: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(227,66,52,.35); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Tab bar (navegación global, móvil) ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-height);
  display: flex;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  font-size: 0.7rem;
  color: var(--fg-50);
  transition: color 200ms ease;
}

.tabbar a svg { stroke: currentColor; transition: stroke 200ms ease; }
.tabbar a:hover { color: var(--fg); }
.tabbar a.active { color: var(--accent); font-weight: 600; }

/* ---------- Contenedor de página genérico (pantallas fuera del feed) ---------- */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header h1 { font-size: 1.4rem; }

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border-radius: 50%;
  transition: background 150ms ease;
}
.back-btn:hover { background: var(--surface); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 1.1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-md);
}

.card h2 { font-size: 1.05rem; margin-bottom: 0.75rem; }

.card > a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-weight: 500;
}
.card > a:hover { color: var(--accent); }
.card > a svg { flex: none; }

/* ===================================================================
   Pantalla Feed — inmersiva, superposiciones
=================================================================== */
.screen-feed { padding-bottom: var(--tabbar-height); }

.feed-item {
  position: relative;
  height: calc(100vh - var(--tabbar-height));
  min-height: 480px;
  overflow: hidden;
  background: #000;
}

.feed-media {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1c1c1f 0%, #141416 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-50);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
}

.feed-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), transparent);
  color: #fff;
}

.feed-topbar .location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}
.feed-topbar .ad-title { flex: 1; font-size: 1rem; margin: 0; font-weight: 700; }
.feed-topbar .icon-btn {
  color: #fff;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

.feed-sidebar {
  position: absolute;
  right: 0.4rem;
  bottom: 7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.feed-sidebar .icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  justify-content: center;
  transition: transform 150ms ease, background 150ms ease;
}
.feed-sidebar .icon-btn:hover { background: rgba(0,0,0,0.55); }
.feed-sidebar .icon-btn:active { transform: scale(0.94); }

.feed-sidebar .count,
.feed-sidebar .label {
  font-size: 0.62rem;
  font-weight: 600;
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
}

.feed-sidebar .like-btn.liked { color: var(--accent); }
.feed-sidebar .like-btn.liked svg { fill: var(--accent); stroke: var(--accent); }

.feed-bottombar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.85rem 1.1rem 1.1rem;
  background: linear-gradient(0deg, rgba(0,0,0,0.65), transparent);
  color: #fff;
}

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s linear;
}

.reward-text {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  transition: color 200ms ease;
}

.reward-text.credited { color: var(--success); font-weight: 600; }

.feed-navarrows {
  position: absolute;
  bottom: 0.85rem;
  right: 1.1rem;
  display: flex;
  gap: 0.5rem;
}

.nav-arrow {
  color: #fff;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms ease;
}
.nav-arrow:hover { background: rgba(0,0,0,0.55); }

/* ---------- Bottom sheet "Más información" ---------- */
.bottomsheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
}

.bottomsheet[hidden] { display: none; }

.bottomsheet-content {
  background: var(--surface-alt);
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}

.bottomsheet-content header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.close-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background 150ms ease;
}
.close-btn:hover { background: var(--surface); }

.info-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--fg-70);
}
.info-list li a { color: var(--accent); }
.info-list li svg { flex: none; color: var(--fg-50); }

.bottomsheet-content > p {
  font-size: 0.9rem;
  color: var(--fg-70);
  margin: 0.75rem 0 0;
}

.cta-btn {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.85rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r);
  font-weight: 600;
  text-align: center;
  min-height: 44px;
  transition: opacity 200ms ease, transform 200ms ease;
}
.cta-btn:hover { opacity: 0.9; }
.cta-btn:active { transform: scale(0.98); }

/* ===================================================================
   Mensajería
=================================================================== */
.conversation-list-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}
.conversation-list-item:hover .name { color: var(--accent); }

.conversation-list-item .avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg-70);
}

.conversation-list-item .meta { flex: 1; min-width: 0; }
.conversation-list-item .name { font-weight: 600; transition: color 150ms ease; }
.conversation-list-item .last-message {
  color: var(--fg-62);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-list-item .time { font-size: 0.75rem; color: var(--fg-50); text-align: right; }
.conversation-list-item .unread-badge {
  margin-top: 4px;
  margin-left: auto;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ---------- Hilo de conversación ---------- */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 5rem;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
}

.chat-composer {
  position: fixed;
  bottom: var(--tabbar-height);
  left: 0; right: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}

.chat-composer input {
  flex: 1;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.95rem;
}
.chat-composer input::placeholder { color: var(--fg-50); }
.chat-composer input:focus { border-color: var(--accent); outline: none; }

.chat-composer button {
  min-height: 44px;
  min-width: 44px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 22px;
  padding: 0 1.1rem;
  font-weight: 600;
  transition: opacity 200ms ease;
}
.chat-composer button:hover { opacity: 0.9; }

/* ===================================================================
   Formularios (sesión, campaña)
=================================================================== */
label { display: block; margin: 0.9rem 0 0.35rem; font-size: 0.85rem; color: var(--fg-62); }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-b);
  font-size: 1rem;
  transition: border-color 200ms ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input::placeholder { color: var(--fg-50); }

.btn-primary {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 1.5rem;
  padding: 0.85rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r);
  font-weight: 700;
  text-align: center;
  transition: opacity 200ms ease, transform 200ms ease;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  margin-top: 0.6rem;
  padding: 0.85rem;
  border: 2px solid var(--surface);
  border-radius: var(--r);
  text-align: center;
  color: var(--fg);
  font-weight: 600;
  transition: border-color 200ms ease;
}
.btn-secondary:hover { border-color: rgba(227,66,52,.55); }

.upload-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--fg-50);
  margin-top: 0.6rem;
  min-height: 44px;
  transition: border-color 200ms ease, color 200ms ease;
  cursor: pointer;
}
.upload-drop:hover { border-color: rgba(227,66,52,.5); color: var(--fg-70); }

.budget-recap {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.budget-recap .amount { font-family: var(--font-h); font-size: 1.3rem; color: var(--accent); }

.balance-amount { font-family: var(--font-h); font-size: 2.1rem; font-weight: 700; }
.balance-sub { color: var(--fg-62); font-size: 0.85rem; margin: 0.2rem 0 0.9rem; }
