/* R261 style.css · distance-ranked-feed · v1.0 */
:root {
  --primary: #EA580C;
  --secondary: #FB923C;
  --accent: #F59E0B;
  --bg: #FFF7ED;
  --card: #FFFFFF;
  --text: #431407;
  --text-secondary: #9A3412;
  --border: #FED7AA;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --tile-bg: #FFEDD5;
  --contact-footer-h: 92px;
  --segment-h: 48px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-chrome-h: calc(var(--contact-footer-h) + var(--safe-area-bottom));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
}
body.has-contact-footer { padding-bottom: calc(var(--contact-footer-h) + var(--segment-h) + 12px + var(--safe-area-bottom)); }

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-header { padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.app-header h1 { font-size: 17px; }
.app-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: center; }
.header-share { font-size: 16px; padding: 8px; color: var(--primary); }

.segment-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px 10px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 99; }
.segment-btn { border: none; background: var(--tile-bg); color: var(--text); padding: 8px 4px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; min-height: 40px; }
.segment-btn.active { background: var(--primary); color: #fff; }

#main { padding: 12px 16px 20px; min-height: 40vh; }

.btn { border: none; border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 600; min-height: 44px; cursor: pointer; display: inline-block; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: var(--card); border: 2px solid var(--border); color: var(--text); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: 12px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.form-group { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 600; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-top: 4px; background: #fff; color: var(--text); }

.chip { border: 1px solid var(--border); background: var(--card); padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chip-col { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--tile-bg); color: var(--primary); font-weight: 600; }
.badge-warn { background: #FEF3C7; color: #92400E; }

.loc-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.toolbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.toolbar-row .cat-scroll { flex: 1; }

.gig-feed { display: flex; flex-direction: column; gap: 8px; }
.gig-card { animation: fadeUp 0.35s ease both; overflow: hidden; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.gig-head { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.dist-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 8px;
  min-width: 48px;
  text-align: center;
  flex-shrink: 0;
}
.gig-main { flex: 1; min-width: 0; }
.gig-main strong { display: block; font-size: 15px; }
.pay-line { color: var(--primary); font-weight: 700; font-size: 16px; }
.icon-btn { border: none; background: transparent; font-size: 18px; color: var(--text-secondary); cursor: pointer; padding: 4px; }
.icon-btn.active { color: var(--warning); }

.gig-body { display: none; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 10px; }
.gig-card.expanded .gig-body, .gig-body.open { display: block; }
.gig-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.map-preview { width: 100%; border-radius: 8px; margin-top: 8px; display: block; }

.filter-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 900; display: flex; align-items: flex-end; }
.filter-drawer { background: var(--card); width: 100%; max-height: 75vh; border-radius: 16px 16px 0 0; padding: 16px; overflow-y: auto; }
.apply-sheet { max-height: 85vh; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 950; }
.modal { max-width: 360px; width: 100%; }
.poster-preview { max-width: 100%; border-radius: 8px; }

.theme-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-pill { border: 1px solid var(--border); background: var(--tile-bg); padding: 8px 12px; border-radius: 999px; font-size: 11px; cursor: pointer; }
.theme-pill.active { background: var(--primary); color: #fff; }

.empty-hint, .empty-state { text-align: center; padding: 20px; color: var(--text-secondary); font-size: 13px; }
.section-title { font-size: 16px; margin-bottom: 10px; }
.meta { font-size: 12px; color: var(--text-secondary); }

.share-main { padding: 24px 16px; min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.share-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; text-align: center; width: 100%; }
.share-icon { font-size: 40px; margin-bottom: 8px; }
.share-slogan { color: var(--text-secondary); font-size: 13px; margin: 8px 0 16px; }
.share-qr { display: flex; justify-content: center; margin: 12px 0; }
.share-link { font-size: 11px; color: var(--text-secondary); margin-bottom: 12px; word-break: break-all; }

.toast-container { position: fixed; left: 50%; bottom: calc(var(--bottom-chrome-h) + var(--segment-h) + 16px); transform: translateX(-50%); z-index: 9999; pointer-events: none; }
.toast-item { background: rgba(0,0,0,0.78); color: #fff; padding: 10px 16px; border-radius: 10px; margin-top: 6px; opacity: 0; transition: opacity 0.3s; font-size: 13px; max-width: 90vw; }
.toast-item.show { opacity: 1; }
.toast-warn { background: rgba(245, 158, 11, 0.92); }

.contact-footer { position: fixed; left: 0; right: 0; bottom: 0; background: #1a1a1a; z-index: 850; padding: 0.55rem 0.75rem calc(0.55rem + var(--safe-area-bottom)); min-height: var(--contact-footer-h); }
.contact-footer__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 88px)); justify-content: center; gap: 0.4rem; max-width: 320px; margin: 0 auto; }
.contact-footer__cta, .contact-footer__btn { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.contact-footer__cta { background: #E87722 !important; color: #fff; }
.contact-footer__btn { background: #333; color: #fff; border: none; cursor: pointer; }
.contact-footer__brand { text-align: center; color: #888; font-size: 10px; margin-top: 6px; }

body.has-contact-footer .zw-root .zw-fab,
body.has-contact-footer .em-entry-btn {
  bottom: calc(var(--contact-footer-h) + var(--segment-h) + 12px + var(--safe-area-bottom)) !important;
}
.editable-field { outline: 2px dashed var(--warning); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
