/* ============================================
   CrickTips — components.css
   Reusable UI components
   ============================================ */

/* ---- Match Cards ---- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }

.match-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s, transform 0.15s; cursor: pointer; }
.match-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.match-card-header { background: var(--bg3); padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.match-type { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.match-live { color: var(--red); font-weight: 700; font-size: 11px; display: flex; align-items: center; gap: 4px; }
.match-live::before { content: '●'; animation: pulse 1s infinite; }
.match-upcoming { color: var(--blue); font-size: 11px; font-weight: 500; }

.match-body { padding: 14px; }
.team-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; }
.team-info { display: flex; align-items: center; gap: 10px; }
.team-flag { font-size: 18px; line-height: 1; }
.team-name { font-weight: 600; font-size: 14px; }
.team-score { font-family: var(--font-heading); font-size: 16px; font-weight: 700; }
.team-score--pending { color: var(--muted); }
.team-overs { font-size: 11px; color: var(--muted); }
.vs-divider { text-align: center; color: var(--muted); font-size: 11px; padding: 4px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 4px 0; }

.match-footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.match-venue { font-size: 11px; color: var(--muted); }
.tip-btn { background: rgba(245,166,35,0.1); color: var(--accent); border: 1px solid rgba(245,166,35,0.3); padding: 4px 12px; border-radius: 5px; font-size: 11px; font-weight: 600; transition: all 0.15s; }
.tip-btn:hover { background: var(--accent); color: #000; }

/* ---- Tip Cards ---- */
.tips-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.tip-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; transition: border-color 0.2s; }
.tip-card:hover { border-color: var(--accent2); }
.tip-match { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tip-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; font-family: var(--font-body); }
.tip-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.tip-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* Tags */
.tag { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.tag-safe { background: rgba(63,185,80,0.15); color: var(--green); }
.tag-risky { background: rgba(248,81,73,0.15); color: var(--red); }
.tag-value { background: rgba(88,166,255,0.15); color: var(--blue); }
.tag-t20 { background: rgba(188,140,255,0.15); color: var(--purple); }
.tag-odi { background: rgba(245,166,35,0.15); color: var(--accent); }
.tag-test { background: rgba(0,201,167,0.15); color: var(--accent2); }
.tag-ipl      { background: rgba(248,81,73,0.15); color: var(--red); }
.tag-football { background: rgba(63,185,80,0.15); color: var(--green); }
.tag-epl      { background: rgba(88,166,255,0.15); color: var(--blue); }
.tag-laliga   { background: rgba(245,166,35,0.15); color: var(--accent); }
.tag-ucl      { background: rgba(188,140,255,0.15); color: var(--purple); }
.tag-seriea   { background: rgba(0,201,167,0.15); color: var(--accent2); }
.tag-vip        { background: rgba(188,140,255,0.15); color: var(--purple); }
.tag-guaranteed { background: rgba(245,166,35,0.15); color: var(--accent); }

/* Sport Switcher */
.sport-switcher { display: flex; gap: 8px; margin-bottom: 20px; }
.sport-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
  cursor: pointer; transition: all 0.2s;
}
.sport-btn:hover { border-color: var(--accent); color: var(--text); }
.sport-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.sport-btn .sport-icon { font-size: 16px; }

/* Football match card accent */
.match-card--football { border-left: 3px solid var(--green); }
.match-card--football .match-type { color: var(--green); }

/* Odds Box */
.tip-odds-box { text-align: center; min-width: 90px; }
.odds-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.odds-value { font-family: var(--font-heading); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; }
.odds-confidence { margin-top: 8px; font-size: 11px; color: var(--muted); }
.confidence-bar { width: 80px; height: 4px; background: var(--bg3); border-radius: 2px; margin: 4px auto 0; overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--accent2)); }
.confidence-fill--risky { background: linear-gradient(90deg, var(--red), var(--accent)); }
.confidence-pct { font-size: 11px; margin-top: 3px; }
.bet-btn { display: block; margin-top: 10px; background: linear-gradient(135deg, var(--accent2), #009d82); color: #000; font-weight: 700; font-size: 11px; padding: 6px 14px; border-radius: 5px; text-align: center; border: none; letter-spacing: 0.5px; width: 100%; }
.bet-btn:hover { opacity: 0.9; }

/* ---- Sidebar Widgets ---- */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.widget { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.widget-header { background: var(--bg3); padding: 12px 16px; border-bottom: 1px solid var(--border); font-family: var(--font-heading); font-size: 16px; font-weight: 700; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.widget-body { padding: 14px 16px; }
.widget-body--compact { padding: 4px 16px; }

/* Expert Leaderboard */
.expert-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.expert-row:last-child { border-bottom: none; }
.expert-rank { font-family: var(--font-heading); font-size: 18px; font-weight: 700; width: 24px; text-align: center; color: var(--muted); }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }
.expert-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.expert-info { flex: 1; min-width: 0; }
.expert-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expert-record { font-size: 11px; color: var(--muted); }
.expert-win { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: var(--green); flex-shrink: 0; }

/* Poll Widget */
.poll-match-label { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.poll-option { display: flex; align-items: center; gap: 10px; padding: 9px 0; cursor: pointer; }
.poll-bar-wrap { flex: 1; height: 28px; background: var(--bg3); border-radius: 5px; overflow: hidden; }
.poll-bar { height: 100%; border-radius: 5px; display: flex; align-items: center; padding-left: 10px; font-size: 12px; font-weight: 600; color: #fff; transition: width 0.5s ease; }
.poll-pct { font-size: 12px; font-weight: 700; min-width: 36px; text-align: right; }
.poll-meta { font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; }
.poll-option--winner .poll-bar-wrap { outline: 2px solid var(--green); }
.btn-poll-vote { display: block; width: 100%; margin-top: 10px; padding: 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 12px; }
.btn-poll-vote:hover { border-color: var(--accent); color: var(--accent); }

/* Upcoming Matches */
.upcoming-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.upcoming-item:last-child { border-bottom: none; }
.upcoming-teams { font-weight: 600; font-size: 13px; }
.upcoming-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; }
.upcoming-time { color: var(--blue); font-weight: 500; }

/* News Items (sidebar) */
.news-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-link { text-decoration: none; color: inherit; display: block; }
.news-link:hover .news-title { color: var(--accent); }
.news-title { font-size: 13px; font-weight: 500; line-height: 1.4; margin-bottom: 4px; transition: color 0.15s; font-family: var(--font-body); }
.news-meta { font-size: 11px; color: var(--muted); }

/* News Grid (full section) */
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.news-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; transition: border-color 0.2s, transform 0.15s;
}
.news-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.news-card--featured { grid-column: 1 / -1; }
.news-card-body { padding: 16px; }
.news-card-source { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.news-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; font-family: var(--font-heading); }
.news-card--featured .news-card-title { font-size: 18px; }
.news-card-desc { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* News Tab Switcher */
.news-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.news-tab {
  padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted); cursor: pointer;
  transition: all 0.2s;
}
.news-tab:hover { border-color: var(--accent); color: var(--text); }
.news-tab.active { background: var(--accent); color: #000; border-color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .match-grid { grid-template-columns: 1fr; }
  .tip-card { grid-template-columns: 1fr; }
  .tip-odds-box { display: flex; align-items: center; gap: 16px; text-align: left; }
  .confidence-bar { margin: 0; }
  .news-grid { grid-template-columns: 1fr; }
  .news-card--featured { grid-column: 1; }

  /* Scrollable tabs on mobile */
  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    width: 100%;
    max-width: 100%;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { flex-shrink: 0; }

  .news-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }
  .news-tabs::-webkit-scrollbar { display: none; }
  .news-tab { flex-shrink: 0; }

  .sport-switcher {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Touch targets */
  .filter-tab { min-height: 36px; display: inline-flex; align-items: center; }
  .sport-btn { min-height: 40px; }
  .tip-btn { min-height: 32px; }
  .bet-btn { min-height: 36px; }

  /* Prevent tip-card right-side from overflowing */
  .tip-card { width: 100%; }
  .tip-title { word-break: break-word; }
  .tip-desc  { word-break: break-word; }
}

@media (max-width: 480px) {
  .match-card-header { flex-wrap: wrap; gap: 4px; }
  .team-name { font-size: 13px; }
  .team-score { font-size: 15px; }
  .tip-title { font-size: 14px; }
  .odds-value { font-size: 24px; }
  .widget-header { font-size: 14px; }
}
