/* ═══════════════════════════════════════════════
   Fanly.Chat — World Cup 2026 Fan App
   Shared Stylesheet
═══════════════════════════════════════════════ */

:root {
  --red:        #E8251A;
  --blue:       #2563EB;
  --red-dim:    rgba(232,37,26,0.15);
  --red-border: rgba(232,37,26,0.3);
  --black:      #080808;
  --surface:    #111111;
  --card:       #161616;
  --card2:      #1C1C1C;
  --border:     rgba(255,255,255,0.07);
  --text:       #F0EDE8;
  --muted:      rgba(240,237,232,0.45);
  --green:      #22c55e;
  --font:       'DM Sans', system-ui, sans-serif;
  --font-head:  'Barlow Condensed', system-ui, sans-serif;
  --font-mono:  'DM Mono', monospace;
  --radius:     8px;
  --radius-sm:  4px;
  --nav-h:      58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
img { display: block; max-width: 100%; }
input, textarea, select {
  font-family: var(--font);
  font-size: 15px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--red); }
::placeholder { color: var(--muted); }

/* ── TYPOGRAPHY ── */
h1,h2,h3,h4 { font-family: var(--font-head); letter-spacing: 0.5px; line-height: 1.1; }
.page-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  color: #fff;
}
.page-title span { color: var(--red); }
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  display: block;
  margin-bottom: 6px;
}
.muted { color: var(--muted); }

/* ── LAYOUT ── */
.page-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + 24px);
}
.page-wrap.wide { max-width: 1080px; }

/* ── NAV (bottom mobile-style + top desktop) ── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.nav-logo {
  font-family: var(--font-head);
  font-size: 23px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.nav-logo .chat-part { color: var(--red); }
.nav-logo span { color: #fff; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-flag {
  width: 26px;
  height: 18px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--red);
  cursor: pointer;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(8,8,8,0.96);
  border-top: 0.5px solid var(--border);
  display: flex;
  height: var(--nav-h);
  backdrop-filter: blur(12px);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s;
  text-decoration: none;
}
.bnav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.bnav-item.active { color: var(--red); }
.bnav-item:hover { color: var(--text); }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-pad { padding: 16px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #c41f15; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-input { width: 100%; padding: 11px 14px; }
.form-textarea { width: 100%; padding: 11px 14px; resize: vertical; min-height: 100px; }
.form-select { width: 100%; padding: 11px 14px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 12px; color: #f87171; margin-top: 4px; }

/* ── POST CARD ── */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.post-card:hover { border-color: rgba(255,255,255,0.12); }
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-author { font-weight: 700; font-size: 14px; color: #fff; }
.post-meta { font-size: 12px; color: var(--muted); }
.post-country {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.post-country img { width: 16px; height: 11px; border-radius: 1px; }
.post-text { font-size: 15px; line-height: 1.6; color: var(--text); margin-bottom: 12px; }
.post-match-card {
  background: var(--card2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}
.post-match-card .flag-sm {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
}
.post-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
  padding: 0;
}
.action-btn:hover { color: var(--text); }
.action-btn.liked { color: var(--red); }
.action-btn svg { width: 16px; height: 16px; }

/* ── MATCH CARD ── */
.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  text-decoration: none;
}
.match-card:hover { border-color: var(--red-border); transform: translateY(-1px); }
.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.match-team.home { align-items: flex-start; text-align: left; }
.match-team.away { align-items: flex-end; text-align: right; }
.match-flag {
  width: 40px;
  height: 27px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.match-team-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.match-center { text-align: center; }
.match-score {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  line-height: 1;
}
.match-vs {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}
.match-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.match-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(232,37,26,0.15);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}
.match-live-dot {
  width: 5px; height: 5px;
  background: var(--red);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* ── PREDICTION BAR ── */
.pred-bar-wrap { margin: 12px 0; }
.pred-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}
.pred-bar {
  height: 6px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.pred-home { background: var(--red); height: 100%; border-radius: 3px 0 0 3px; transition: width 0.5s; }
.pred-draw { background: #666; height: 100%; transition: width 0.5s; }
.pred-away { background: #3b82f6; height: 100%; border-radius: 0 3px 3px 0; transition: width 0.5s; }
.pred-counts {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── CHAT MESSAGES ── */
.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.chat-flag {
  width: 22px; height: 15px;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 3px;
}
.chat-name { font-weight: 700; font-size: 13px; color: #fff; }
.chat-text { font-size: 14px; color: var(--text); line-height: 1.4; }
.chat-time { font-size: 10px; color: var(--muted); margin-left: auto; flex-shrink: 0; margin-top: 2px; }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
}
.badge-red { background: var(--red-dim); border: 1px solid var(--red-border); color: var(--red); }
.badge-green { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.badge-gray { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--muted); }

/* ── DIVIDER ── */
.divider { height: 0.5px; background: var(--border); margin: 20px 0; }

/* ── TABS ── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 7px 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 3px;
  transition: all 0.15s;
}
.tab-btn.active {
  background: var(--red);
  color: #fff;
}

/* ── FEED HEADER ── */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
}

/* ── COMPOSE BOX ── */
.compose-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.compose-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.compose-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.compose-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  padding: 0;
  min-height: 48px;
}
.compose-input:focus { border: none; outline: none; }
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}
.compose-attach {
  display: flex;
  align-items: center;
  gap: 8px;
}
.attach-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  transition: all 0.15s;
}
.attach-btn:hover { border-color: var(--red-border); color: var(--red); }

/* ── LEADERBOARD ── */
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.lb-row:hover { border-color: rgba(255,255,255,0.12); }
.lb-rank {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 900;
  color: var(--muted);
  width: 28px;
  flex-shrink: 0;
}
.lb-rank.gold { color: #FBBF24; }
.lb-rank.silver { color: #9CA3AF; }
.lb-rank.bronze { color: #B45309; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 700; font-size: 14px; color: #fff; }
.lb-sub { font-size: 12px; color: var(--muted); }
.lb-score {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 900;
  color: var(--red);
}

/* ── GROUP TABLE ── */
.group-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.group-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 0.5px solid var(--border);
}
.group-table td { padding: 8px 8px; border-bottom: 0.5px solid var(--border); }
.group-table tr:last-child td { border-bottom: none; }
.group-table .qualify { background: rgba(34,197,94,0.04); }
.team-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; }
.team-cell img { width: 22px; height: 15px; border-radius: 2px; object-fit: cover; }

/* ── ALERT / TOAST ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(34,197,94,0.4); color: var(--green); }
.toast.error { border-color: var(--red-border); color: var(--red); }

/* ── LOADING SKELETON ── */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-head); font-size: 22px; color: var(--text); margin-bottom: 6px; }

/* ── RESPONSIVE ── */
@media (min-width: 640px) {
  .page-wrap { padding: 0 24px calc(var(--nav-h) + 32px); }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; border: 1px solid var(--border); border-bottom: none; }
}
@media (max-width: 420px) {
  .match-card { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .match-flag { width: 32px; height: 22px; }
}

/* ── SPORT FLAIR BADGE ── */
.sport-flair {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
  color: #22c55e;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-head);
}

/* ── CLUB FLAIR BADGES ── */
.club-flair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1.5px solid;
  cursor: default;
}
/* Club colors set by JS via data-club attribute */
.club-flair[data-club="LFC"]  { background:#C8102E22; border-color:#C8102E88; color:#C8102E; }
.club-flair[data-club="MU"]   { background:#DA291C22; border-color:#DA291C88; color:#DA291C; }
.club-flair[data-club="AFC"]  { background:#EF010722; border-color:#EF010788; color:#EF0107; }
.club-flair[data-club="FCB"]  { background:#A5004422; border-color:#A5004488; color:#A50044; }
.club-flair[data-club="BFCB"] { background:#DC052D22; border-color:#DC052D88; color:#DC052D; }
.club-flair[data-club="MC"]   { background:#6CABDD22; border-color:#6CABDD88; color:#6CABDD; }
.club-flair[data-club="CFC"]  { background:#03469422; border-color:#03469488; color:#034694; }
.club-flair[data-club="RM"]   { background:#FEBE1022; border-color:#FEBE1088; color:#FEBE10; }
.club-flair[data-club="BVB"]  { background:#FDE10022; border-color:#FDE10088; color:#c9b300; }
.club-flair[data-club="JUV"]  { background:#ffffff12; border-color:#ffffff44; color:#ffffff; }
.club-flair[data-club="PSG"]  { background:#00417022; border-color:#00417088; color:#4a9eff; }
.club-flair[data-club="INT"]  { background:#010E8022; border-color:#010E8088; color:#7b9eff; }
.club-flair[data-club="ACM"]  { background:#FB090B22; border-color:#FB090B88; color:#FB090B; }
.club-flair[data-club="ATM"]  { background:#CE352422; border-color:#CE352488; color:#CE3524; }
.club-flair[data-club="THF"]  { background:#13225722; border-color:#13225788; color:#7b9eff; }
.club-flair[data-club="AJX"]  { background:#CC000022; border-color:#CC000088; color:#CC0000; }
.club-flair[data-club="NCFC"] { background:#00000022; border-color:#ffffff44; color:#ffffff; }
.club-flair[data-club="SEV"]  { background:#CC000022; border-color:#CC000088; color:#CC0000; }
.club-flair[data-club="B04"]  { background:#E3272522; border-color:#E3272588; color:#E32725; }
.club-flair[data-club="SSN"]  { background:#12A0C322; border-color:#12A0C388; color:#12A0C3; }
.club-flair[data-club="ASR"]  { background:#8E1F2F22; border-color:#8E1F2F88; color:#F5BC42; }
.club-flair[data-club="OLY"]  { background:#0033A022; border-color:#0033A088; color:#4a9eff; }
.club-flair[data-club="SLB"]  { background:#CC000022; border-color:#CC000088; color:#CC0000; }
.club-flair[data-club="FCP"]  { background:#00337022; border-color:#00337088; color:#4a9eff; }
