/* ═══════════════════════════════════════════════════════════════════
   FUTBOL.AZ – Live Matches & Goal Notifications Stylesheet
   ═══════════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────────── */
#live-section {
  padding: 40px 0 60px;
  animation: sectionFadeIn .5s ease both;
}

.live-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.live-section-title {
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e74c3c;
  animation: pulseDot 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(1.5); }
}

/* ── Tab bar ─────────────────────────────────────────────────────── */
.live-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.live-tab-btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.live-tab-btn:hover {
  border-color: var(--border-h);
  color: var(--text);
}

.live-tab-btn:focus-visible,
.icon-toggle-btn:focus-visible,
.filter-btn:focus-visible,
.filter-select:focus-visible,
#date-filter:focus-visible,
.live-only-toggle:focus-within,
.match-card:focus-visible,
.show-toggle-btn:focus-visible {
  outline: 2px solid var(--blue-lt);
  outline-offset: 2px;
}

.live-tab-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── Settings / notification bar ────────────────────────────────── */
.live-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm);
}

.live-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.live-badge.red   { background: rgba(231,76,60,.15); color: #e74c3c; }
.live-badge.green { background: rgba(39,174,96,.15);  color: #27ae60; }
.live-badge.muted { background: var(--bg-card);       color: var(--text-muted); }

.live-refresh-info {
  font-size: .78rem;
  color: var(--text-muted);
}

.icon-toggle-btn {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: .83rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.icon-toggle-btn:hover { border-color: var(--border-h); color: var(--text); }
.icon-toggle-btn.on    { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Match cards grid ────────────────────────────────────────────── */
.live-matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ── Single match card ───────────────────────────────────────────── */
.match-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.match-card:hover {
  border-color: var(--border-h);
  background: var(--bg-card-h);
  box-shadow: var(--shadow-sm);
  transform: translateY(-4px);
}

.match-card.live-now {
  border-color: rgba(231,76,60,.4);
}

.match-card.live-now::after {
  content: "LIVE";
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: .6rem;
  font-weight: 800;
  color: #fff;
  background: #e74c3c;
  border-radius: 20px;
  padding: 2px 6px;
  letter-spacing: .08em;
  animation: pulseDot 1.2s ease-in-out infinite;
}

.match-card.goal-flash {
  animation: goalFlash .55s ease-out;
}

.match-card.important-match {
  border-color: rgba(241, 196, 15, .35);
  box-shadow: 0 0 0 1px rgba(241, 196, 15, .15), var(--shadow-sm);
}

@keyframes goalFlash {
  0%   { box-shadow: 0 0 0 0 rgba(241,196,15,.34); }
  100% { box-shadow: 0 0 0 8px rgba(241,196,15,0); }
}

/* Competition badge at the top of each card */
.match-comp {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-comp img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Teams row */
.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.match-team-crest {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.match-team-crest-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.match-team-name {
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.match-team-subname {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* Score display */
.match-score-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 88px;
}

.match-score {
  font-size: clamp(1.55rem, 2.2vw, 1.9rem);
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: .01em;
}

.match-score.live-now { color: #e74c3c; }
.match-score-kickoff {
  font-size: 1.02rem;
  color: var(--text-muted);
}

.match-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-live {
  background: rgba(231,76,60,.16);
  color: #ff6b6b;
  border-color: rgba(231,76,60,.32);
}
.status-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 1.2s ease-in-out infinite;
}
.status-ft,
.status-ht,
.status-other {
  color: var(--text-muted);
  border-color: var(--border);
}
.status-ft { background: rgba(39,174,96,.1); }
.status-ht { background: rgba(241,196,15,.08); }
.status-upcoming {
  background: rgba(52,152,219,.1);
  color: #5dade2;
  border-color: rgba(52,152,219,.3);
}
.status-other { background: var(--bg2); }

/* Half time score */
.match-ht {
  font-size: .7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.25;
}

/* Favorite star */
.match-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: .45;
  transition: opacity .2s, transform .15s;
  line-height: 1;
}

.match-pin-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  z-index: 2;
}

.match-pin-btn.pinned {
  border-color: rgba(241, 196, 15, .6);
  background: rgba(241, 196, 15, .2);
}

.match-fav-btn:hover           { opacity: .8; }
.match-fav-btn[aria-pressed="true"] { opacity: 1; transform: scale(1.15); }

/* ── Goal scorer list inside card ─────────────────────────────────── */
.match-goals {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 80px;
  overflow-y: auto;
}

.match-goal-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Empty / loading states ──────────────────────────────────────── */
.live-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.live-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.live-empty-text { font-size: .95rem; margin-bottom: 8px; }
.live-empty-sub  { font-size: .82rem; }

.live-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 24px;
  gap: 12px;
  color: var(--text-muted);
  font-size: .95rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Goal notification toast ─────────────────────────────────────── */
#goal-toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
  width: calc(100% - 32px);
}

.goal-toast {
  background: linear-gradient(135deg, #1a1f3a 0%, #0d1028 100%);
  border: 1.5px solid rgba(241,196,15,.5);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(241,196,15,.15);
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
  position: relative;
  overflow: hidden;
}

.goal-toast::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(241,196,15,.06) 0%, transparent 100%);
  pointer-events: none;
}

[data-theme="light"] .goal-toast {
  background: #fff;
  border-color: rgba(241,196,15,.6);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(.9); }
  to   { opacity: 1; transform: translateX(0)    scale(1);  }
}

.goal-toast-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
  animation: ballBounce .5s ease-out;
}

@keyframes ballBounce {
  0%  { transform: translateY(-6px); }
  60% { transform: translateY(3px);  }
  100%{ transform: translateY(0);    }
}

.goal-toast-body { flex: 1; min-width: 0; }

.goal-toast-title {
  font-size: .78rem;
  font-weight: 700;
  color: #f1c40f;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
}

.goal-toast-scorer {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .goal-toast-scorer { color: #1a1f3a; }

.goal-toast-match {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-toast-score {
  font-size: 1.1rem;
  font-weight: 900;
  color: #f1c40f;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.goal-toast-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: .8rem;
  cursor: pointer;
  opacity: .4;
  color: var(--text);
  line-height: 1;
  padding: 2px 4px;
}

.goal-toast-dismiss:hover { opacity: .8; }

/* Celebration particles overlay */
@keyframes celebrate {
  0%   { transform: translateY(0) rotate(0)   scale(1);   opacity:1; }
  100% { transform: translateY(-90px) rotate(720deg) scale(0); opacity:0; }
}

.celebrate-particle {
  position: fixed;
  pointer-events: none;
  font-size: 1.4rem;
  z-index: 10000;
  animation: celebrate 1.2s ease-out forwards;
}

/* ── Settings panel (modal-style) ────────────────────────────────── */
#live-settings-panel {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

#live-settings-panel.open { display: flex; }

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.settings-sheet {
  position: relative;
  background: var(--bg-modal);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.5);
  animation: sheetUp .28s ease-out;
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.settings-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 20px;
}

.settings-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  text-align: center;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.settings-row:last-of-type { border-bottom: none; }

.settings-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--text);
  font-weight: 500;
}

.settings-label-icon { font-size: 1.1rem; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: background .2s;
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}

.toggle-switch input:checked + .toggle-track               { background: var(--blue); }
.toggle-switch input:checked + .toggle-track::after        { transform: translateX(18px); }

/* Favorite team select */
.settings-select {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 6px 10px;
  font-size: .85rem;
  max-width: 160px;
}

.settings-close-btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  border: none;
  cursor: pointer;
  transition: background .2s;
}

.settings-close-btn:hover { background: var(--blue-lt); }

/* ── Competition filter bar ──────────────────────────────────────── */
.comp-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.comp-filter-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.comp-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.comp-filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.comp-filter-chip:hover {
  border-color: var(--border-h);
  color: var(--text);
}

.comp-filter-chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── New filters ───────────────────────────────────────────────────── */
.live-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  position: sticky;
  top: calc(var(--navbar-h) + 8px);
  z-index: 20;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm);
}

.date-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-btn,
.filter-select,
#date-filter {
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
}

.filter-btn {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
}

.filter-select {
  min-width: 160px;
}

.live-only-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
}

/* ── Loading skeleton ─────────────────────────────────────────────── */
.live-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.match-skeleton {
  height: 165px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg2) 37%, var(--bg-card) 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.3s ease infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .live-matches-grid {
    grid-template-columns: 1fr;
  }

  .live-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Tabs: horizontal scroll so buttons never wrap onto a new row */
  .live-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .live-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Toolbar: stack left/right sections vertically */
  .live-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .live-filters {
    top: calc(var(--navbar-h) + 6px);
    padding: 10px;
  }

  .live-toolbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .live-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }

  /* Action buttons: up to 3 per row, fully tappable */
  .icon-toggle-btn {
    flex: 1 1 calc(33.333% - 8px);
    text-align: center;
    padding: 10px 8px;
    min-width: 0;
  }

  #goal-toast-container {
    top: 70px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .comp-filter-bar {
    gap: 8px;
  }

  .live-filters,
  .date-filter-group {
    width: 100%;
  }

  .filter-select,
  #date-filter {
    flex: 1;
    min-width: 0;
  }

  .date-filter-group .filter-btn {
    flex: 1;
  }
}

@media (max-width: 380px) {
  .match-team-name {
    font-size: .78rem;
  }
  .match-score-area {
    min-width: 78px;
  }
}

/* ── Show all / collapse toggle button ──────────────────────────────── */
.show-toggle-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  font-family: inherit;
}

.show-toggle-btn:hover {
  border-color: var(--blue);
  color: var(--blue-lt);
  background: rgba(0,61,165,.07);
}

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

/* ══════════════════════════════════════════════════════════════════
   AD LAYOUT STABILITY – reserve space to reduce Cumulative Layout Shift
   Auto Ads can inject banners anywhere; these containers give them
   a stable home so the match-cards don't jump around.
   ══════════════════════════════════════════════════════════════════ */

/* Reserved ad slot between sections / after match list */
.live-ad-slot {
  width: 100%;
  min-height: 90px;          /* standard leaderboard height */
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  contain: layout style;     /* limit reflow propagation */
}

/* Prevent Auto Ads from inserting inside match cards */
.match-card, .league-group {
  contain: layout;
}

/* When an ad is injected by Auto Ads, keep it from collapsing to 0 then
   expanding (the main source of CLS). The ins element Auto Ads writes is
   display:block by default; enforce a minimum size so the slot doesn't
   jump from 0→90 px. */
.live-ad-slot ins,
.live-ad-slot > * {
  min-height: 90px;
  width: 100%;
}

@media (max-width: 768px) {
  .live-ad-slot {
    min-height: 100px;       /* mobile banner / rect */
  }
  .live-ad-slot ins,
  .live-ad-slot > * {
    min-height: 100px;
  }
}
