:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #5b6270;
  --border: #e3e5e9;
  --accent: #c8102e;
  --chip-bg: #eceef1;
  --chip-bg-active: #1a1d23;
  --chip-text-active: #ffffff;
  --new-badge: #c8102e;

  --cat-exclusivos: #b8860b;
  --cat-paneles: #2563eb;
  --cat-firmas: #7c3aed;
  --cat-boletos: #0891b2;
  --cat-noticias: #16a34a;
  --cat-general: #6b7280;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #1a1d23;
    --text: #eef0f3;
    --text-muted: #9aa1ad;
    --border: #2a2e37;
    --accent: #ff4d5e;
    --chip-bg: #262a33;
    --chip-bg-active: #eef0f3;
    --chip-text-active: #0f1115;
    --new-badge: #ff4d5e;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Los mapas usan la tecnica "full-bleed" (100vw) para ocupar todo el ancho de
     pantalla rompiendo el max-width centrado de <main>; esto evita el scroll horizontal
     que esa tecnica puede introducir. */
  overflow-x: hidden;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

header h1 {
  font-size: 1.15rem;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lang-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#auth-area {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-login-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.auth-user {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-user img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}
.auth-user-name {
  font-size: 0.75rem;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-logout-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  text-decoration: underline;
}

.disclaimer-banner {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--chip-bg);
  border-radius: 8px;
  padding: 5px 8px;
  margin: 6px 0;
  line-height: 1.3;
}

.app-footer {
  margin-top: 24px;
  padding: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.app-footer a {
  color: var(--text-muted);
}

header h1 .badge-count {
  font-size: 0.7rem;
  background: var(--new-badge);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 600;
}

.meta-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.search-box {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}
.chip.active {
  background: var(--chip-bg-active);
  color: var(--chip-text-active);
  font-weight: 600;
}
.chip .count {
  opacity: 0.65;
  margin-left: 4px;
}

main {
  padding: 12px 16px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  overflow: hidden;
}

.card-thumb {
  display: block;
  width: calc(100% + 32px);
  margin: -14px -16px 12px;
  max-height: 220px;
  object-fit: cover;
  background: var(--chip-bg);
}

.card-quick-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.quick-chip {
  font-size: 0.76rem;
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.quick-chip-time { color: var(--accent); font-weight: 600; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.fav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}
.fav-btn.active {
  color: var(--accent);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.35;
}

.card-new-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--new-badge);
  margin-top: 6px;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.category-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 8px;
}
.category-pill.cat-exclusivos-y-ventas { background: var(--cat-exclusivos); }
.category-pill.cat-paneles-y-horarios { background: var(--cat-paneles); }
.category-pill.cat-firmas { background: var(--cat-firmas); }
.category-pill.cat-boletos-y-registro { background: var(--cat-boletos); }
.category-pill.cat-noticias-y-guias { background: var(--cat-noticias); }
.category-pill.cat-general { background: var(--cat-general); }

.card-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.card-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  display: none;
}
.card.expanded .card-details { display: block; }

.detail-row {
  margin-bottom: 10px;
}
.detail-row b { color: var(--text-muted); font-weight: 600; }

.schedule-item {
  background: var(--chip-bg);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.schedule-item-when {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 3px;
}
.schedule-item-desc {
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Vista calendario */
.view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.view-toggle button {
  flex: 1 1 45%;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
}
.view-toggle button.active {
  background: var(--chip-bg-active);
  color: var(--chip-text-active);
  font-weight: 600;
  border-color: transparent;
}

.day-group {
  margin-bottom: 18px;
}
.day-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 8px;
  position: sticky;
  top: 128px;
  background: var(--bg);
  padding: 4px 0;
}
.agenda-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.agenda-row-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}
.agenda-row-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 8px;
}
.agenda-row-desc {
  font-size: 0.88rem;
  margin-top: 4px;
  line-height: 1.4;
}
.agenda-row-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
}
.agenda-row-cat {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.agenda-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.product-vendor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Vista Mi Plan */
.planner-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.planner-item.conflict {
  border-color: var(--new-badge);
}
.planner-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.planner-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 4px 0;
}
.conflict-warning, .zone-change-warning {
  font-size: 0.76rem;
  border-radius: 8px;
  padding: 5px 8px;
  margin-bottom: 6px;
}
.conflict-warning {
  background: var(--chip-bg);
  color: var(--new-badge);
  border: 1px solid var(--new-badge);
}
.zone-change-warning {
  background: var(--chip-bg);
  color: var(--text-muted);
}

.map-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 12px 0 8px;
}
/* Los mapas se extienden a todo el ancho de la pantalla (rompiendo el max-width
   centrado de <main>), tanto en web como en celular, para aprovechar todo el espacio. */
#planner-map,
#all-zones-map,
#floormap-canvas {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

#planner-map {
  height: 320px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.planner-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 22px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.planner-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

#all-zones-map {
  height: 280px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.zone-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
}
.zone-list-item-title {
  font-size: 0.85rem;
  margin: 3px 0;
}

/* Mapa del piso (imagen real + clustering) */
#floormap-canvas {
  height: 65vh;
  min-height: 380px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #1a1a1a;
}
#floormap-search-results {
  margin-top: 8px;
}
.booth-popup {
  max-width: 240px;
  font-size: 0.85rem;
}
.booth-popup-item {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.booth-popup-item a {
  color: var(--accent);
}

.booth-marker {
  font-size: 1.1rem;
  text-align: center;
  line-height: 22px;
}

#booth-detail-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid var(--border);
}
#booth-detail-panel textarea {
  width: 100%;
  margin: 8px 0;
  resize: vertical;
  font-family: inherit;
}

.booth-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.booth-photo-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.tag-list span {
  background: var(--chip-bg);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.78rem;
}

.link-list a {
  display: block;
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 4px;
  word-break: break-word;
}
.link-list a:active { opacity: 0.7; }

.manager-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.manager-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.manager-row textarea,
.manager-row input {
  margin-bottom: 6px;
}
.manager-row .refresh-btn {
  display: inline-block;
  width: auto;
  padding: 8px 14px;
  margin-top: 0;
  margin-right: 6px;
  font-size: 0.82rem;
}

.card-original-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.load-more, .refresh-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 8px;
  cursor: pointer;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--chip-bg);
}
.product-thumb-empty {
  display: flex;
}
.product-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-vendor {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.product-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}
.product-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}
.product-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state, .loading-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  font-size: 0.9rem;
}

/* ===================== Tienda / marketplace ===================== */
.store-tabs { display: flex; gap: 8px; margin: 8px 0; }
.store-tabs button {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600;
}
.store-tabs button.active { background: var(--chip-bg-active); color: var(--chip-text-active); }
.store-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.store-filters .search-box { flex: 1; min-width: 120px; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.store-card {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface); cursor: pointer; transition: transform .08s;
}
.store-card:hover { transform: translateY(-2px); }
.store-card-img { width: 100%; aspect-ratio: 1/1; background-size: cover; background-position: center; }
.store-card-noimg { display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: var(--chip-bg); }
.store-card-body { padding: 8px 10px; }
.store-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.store-card-title { font-weight: 600; margin: 4px 0; font-size: 0.92rem; line-height: 1.2; }
.store-card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.store-chip { background: var(--chip-bg); color: var(--text-muted); font-size: 0.72rem; padding: 2px 7px; border-radius: 20px; }
.store-price { color: var(--accent); white-space: nowrap; }
.store-price-lg { color: var(--accent); font-size: 1.3rem; }
.store-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; color: #fff; }
.store-badge-available { background: #16a34a; }
.store-badge-reserved { background: #d97706; }
.store-badge-sold { background: #6b7280; }
.store-detail { padding: 4px 2px; }
.store-detail-photos { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.store-photo { height: 200px; border-radius: 8px; object-fit: cover; }
.store-detail-noimg { width: 200px; height: 200px; }
.store-photo-wrap { position: relative; flex: 0 0 auto; }
.store-photo-del {
  position: absolute; top: 4px; right: 4px; border: none; border-radius: 50%;
  width: 24px; height: 24px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
}
.store-detail-top { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.store-desc { white-space: pre-wrap; color: var(--text); margin: 8px 0; }
.store-status-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.store-status-btn {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.store-status-btn.active { background: var(--chip-bg-active); color: var(--chip-text-active); }
.store-form { display: flex; flex-direction: column; gap: 6px; }
.store-form-row { display: flex; gap: 10px; }
.store-form-row > div { flex: 1; }
.store-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; margin-top: 6px; }
.store-back { background: var(--chip-bg) !important; color: var(--text) !important; }
.store-danger { background: #b91c1c !important; color: #fff !important; }

/* ===================== Catálogo + Carrito ===================== */
.cat-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; color: #fff; }
.cat-badge-official_exclusive { background: #b8860b; }
.cat-badge-reseller { background: #7c3aed; }
.cat-badge-general { background: #6b7280; }
.cart-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.cart-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--surface); }
.cart-thumb { width: 60px; height: 60px; border-radius: 8px; background-size: cover; background-position: center; flex: 0 0 auto; }
.cart-thumb-none { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--chip-bg); }
.cart-row-body { flex: 1; min-width: 0; }
.cart-source { font-size: 0.72rem; color: var(--text-muted); }
.cart-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cart-row-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.cart-view-btn, .cart-remove-btn { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.8rem; }
.cart-remove-btn { color: #b91c1c; }
.floormap-legal { font-size: 0.72rem; font-style: italic; opacity: 0.85; margin-top: 4px; }

/* ===================== Moderación ===================== */
.link-report { background: none; border: none; color: var(--text-muted); text-decoration: underline; cursor: pointer; font-size: 0.8rem; margin-top: 8px; display: block; }
.mod-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--surface); margin-bottom: 8px; }
.mod-row-body { flex: 1; min-width: 0; }
.mod-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.mod-btn { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.8rem; }
.mod-remove { color: #b45309; }
.mod-ban { color: #b91c1c; }
