/* =========================================================
   Polla Mundialista 2026 — Styles
   Font: Poppins | Primary: #0d1e4d | White headers | Black content
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ── Custom Properties ───────────────────────────────────── */
:root {
  --pm-primary:      #0d1e4d;
  --pm-primary-dark: #081438;
  --pm-primary-mid:  #162a6e;
  --pm-accent:       #e8b400;
  --pm-accent2:      #e05c1a;
  --pm-white:        #ffffff;
  --pm-black:        #111111;
  --pm-gray-light:   #f4f6fb;
  --pm-gray:         #e0e4ef;
  --pm-gray-mid:     #8a96b0;
  --pm-success:      #1a9e5c;
  --pm-error:        #d63031;
  --pm-radius:       12px;
  --pm-radius-sm:    8px;
  --pm-shadow:       0 4px 20px rgba(13,30,77,.12);
  --pm-shadow-lg:    0 8px 40px rgba(13,30,77,.20);
  --pm-font:         'Poppins', sans-serif;
  --pm-title-size:   14pt;
  --pm-sub-size:     12pt;
}

/* ── Base reset for plugin ───────────────────────────────── */
.pm-wrap *,
.pm-wrap *::before,
.pm-wrap *::after { box-sizing: border-box; }

.pm-wrap {
  font-family: var(--pm-font);
  color: var(--pm-black);
  font-size: 14px;
  line-height: 1.6;
  max-width: 960px;
  margin: 0 auto 48px;
}

/* ── Header block ────────────────────────────────────────── */
.pm-header {
  background: linear-gradient(135deg, var(--pm-primary) 0%, var(--pm-primary-mid) 60%, #1e3a8a 100%);
  border-radius: var(--pm-radius);
  padding: 28px 32px 24px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.pm-header::before {
  content: '⚽';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 80px;
  opacity: .08;
  pointer-events: none;
}
.pm-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(255,255,255,.02) 20px,
    rgba(255,255,255,.02) 40px
  );
}

/* TITLES — 14pt, white on dark header */
.pm-title {
  font-family: var(--pm-font);
  font-size: var(--pm-title-size);
  font-weight: 700;
  color: var(--pm-white);
  margin: 0 0 6px;
  position: relative;
  z-index: 1;
}

/* SUBTITLES — 12pt, white on dark header */
.pm-subtitle {
  font-family: var(--pm-font);
  font-size: var(--pm-sub-size);
  font-weight: 400;
  color: rgba(255,255,255,.82);
  margin: 0;
  position: relative;
  z-index: 1;
}

/* ── Alert ───────────────────────────────────────────────── */
.pm-alert {
  padding: 14px 20px;
  border-radius: var(--pm-radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
}
.pm-alert-warning {
  background: #fff8e1;
  border-left: 4px solid var(--pm-accent);
  color: #7a5800;
}
.pm-alert-warning a { color: var(--pm-primary); font-weight: 600; }

.pm-empty {
  text-align: center;
  color: var(--pm-gray-mid);
  padding: 40px 20px;
  font-size: 15px;
}

/* ── Group section headers ───────────────────────────────── */
.pm-group-section,
.pm-fixture-group { margin-bottom: 24px; }

.pm-group-label {
  background: var(--pm-primary);
  color: var(--pm-white);
  font-family: var(--pm-font);
  font-size: var(--pm-sub-size);
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--pm-radius-sm);
  display: inline-block;
  margin-bottom: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ── Match card (predictions) ────────────────────────────── */
.pm-match-card {
  background: var(--pm-white);
  border: 2px solid var(--pm-gray);
  border-radius: var(--pm-radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--pm-shadow);
  transition: border-color .25s, box-shadow .25s, transform .2s;
}
.pm-match-card:hover {
  border-color: var(--pm-primary);
  box-shadow: var(--pm-shadow-lg);
  transform: translateY(-2px);
}
.pm-match-card.pm-saved {
  border-color: var(--pm-success);
  background: linear-gradient(to right, #f0fdf7, #fff);
}

.pm-match-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--pm-gray-mid);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pm-venue { color: var(--pm-primary); opacity: .7; }

.pm-match-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pm-team {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
}
.pm-team-away { flex-direction: row-reverse; text-align: right; }
.pm-flag { font-size: 24px; line-height: 1; }
.pm-team-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--pm-black);
  white-space: nowrap;
}

/* Score inputs */
.pm-score-input {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pm-score {
  width: 52px;
  height: 44px;
  text-align: center;
  font-family: var(--pm-font);
  font-size: 20px;
  font-weight: 700;
  color: var(--pm-primary);
  border: 2px solid var(--pm-gray);
  border-radius: var(--pm-radius-sm);
  outline: none;
  transition: border-color .2s;
  -moz-appearance: textfield;
}
.pm-score::-webkit-outer-spin-button,
.pm-score::-webkit-inner-spin-button { -webkit-appearance: none; }
.pm-score:focus { border-color: var(--pm-primary); }
.pm-vs {
  font-size: 18px;
  font-weight: 700;
  color: var(--pm-gray-mid);
}

/* Save button */
.pm-btn-save {
  background: var(--pm-primary);
  color: var(--pm-white);
  font-family: var(--pm-font);
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: var(--pm-radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: background .2s, transform .15s;
  white-space: nowrap;
}
.pm-btn-save:hover {
  background: var(--pm-primary-mid);
  transform: scale(1.03);
}
.pm-btn-save:active { transform: scale(.97); }

/* Feedback */
.pm-match-feedback {
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  min-height: 18px;
  transition: opacity .3s;
}
.pm-match-feedback.success { color: var(--pm-success); }
.pm-match-feedback.error   { color: var(--pm-error); }

/* ── Ranking table ───────────────────────────────────────── */
.pm-table-wrapper {
  overflow-x: auto;
  border-radius: var(--pm-radius);
  box-shadow: var(--pm-shadow);
}

.pm-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--pm-font);
  font-size: 14px;
  background: var(--pm-white);
}
.pm-table thead tr {
  background: var(--pm-primary);
}
.pm-table thead th {
  color: var(--pm-white);
  font-size: var(--pm-sub-size);
  font-weight: 600;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
}
.pm-th-rank { width: 48px; text-align: center; }

.pm-table tbody tr {
  border-bottom: 1px solid var(--pm-gray);
  transition: background .18s;
}
.pm-table tbody tr:hover { background: var(--pm-gray-light); }
.pm-table tbody tr:last-child { border-bottom: none; }
.pm-table td {
  padding: 12px 16px;
  color: var(--pm-black);
}
.pm-td-rank { text-align: center; font-size: 18px; }
.pm-td-pts  { font-size: 16px; color: var(--pm-primary); }
.pm-td-pts strong { font-weight: 700; }

.pm-row-me {
  background: linear-gradient(to right, #e8eeff, #f0f5ff) !important;
  border-left: 3px solid var(--pm-primary);
}
.pm-you {
  font-size: 11px;
  font-weight: 600;
  color: var(--pm-primary);
  background: #e0e8ff;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
}

/* ── Results grid ────────────────────────────────────────── */
.pm-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.pm-result-card {
  background: var(--pm-white);
  border: 2px solid var(--pm-gray);
  border-radius: var(--pm-radius);
  padding: 16px 18px;
  box-shadow: var(--pm-shadow);
  text-align: center;
}
.pm-result-stage {
  font-size: 10px;
  font-weight: 600;
  color: var(--pm-primary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
  background: var(--pm-gray-light);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
}
.pm-result-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.pm-rf { font-size: 22px; }
.pm-rn { font-size: 12px; font-weight: 600; color: var(--pm-black); }
.pm-rs {
  font-size: 20px;
  font-weight: 800;
  color: var(--pm-primary);
  padding: 0 6px;
  min-width: 70px;
  text-align: center;
}

/* ── Fixture list ────────────────────────────────────────── */
.pm-fixture-list { display: flex; flex-direction: column; gap: 0; }

.pm-fixture-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--pm-radius-sm);
  margin-bottom: 6px;
  background: var(--pm-white);
  border: 1px solid var(--pm-gray);
  box-shadow: 0 2px 8px rgba(13,30,77,.06);
  flex-wrap: wrap;
  transition: background .18s;
}
.pm-fixture-row:hover { background: var(--pm-gray-light); }
.pm-fixture-row.pm-finished {
  border-color: var(--pm-success);
  background: linear-gradient(to right, #f0fdf7, #fff);
}

.pm-fx-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--pm-primary);
  min-width: 70px;
  white-space: nowrap;
}
.pm-fx-teams {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--pm-black);
  justify-content: center;
}
.pm-fx-score {
  font-size: 16px;
  font-weight: 800;
  color: var(--pm-primary);
  min-width: 48px;
  text-align: center;
}
.pm-fx-venue {
  font-size: 10px;
  color: var(--pm-gray-mid);
  min-width: 180px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Toast notification ──────────────────────────────────── */
#pm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--pm-primary);
  color: var(--pm-white);
  font-family: var(--pm-font);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--pm-radius-sm);
  box-shadow: var(--pm-shadow-lg);
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#pm-toast.show {
  opacity: 1;
  transform: translateY(0);
}
#pm-toast.pm-toast-error { background: var(--pm-error); }

/* ── Loading spinner ─────────────────────────────────────── */
.pm-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--pm-white);
  border-radius: 50%;
  animation: pm-spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

/* Tablet ≤ 768px */
@media (max-width: 768px) {
  .pm-header { padding: 20px 20px 18px; }
  .pm-title   { font-size: 13pt; }
  .pm-subtitle{ font-size: 11pt; }

  .pm-match-body { flex-direction: column; align-items: stretch; }
  .pm-team       { justify-content: space-between; }
  .pm-team-away  { flex-direction: row; text-align: left; }
  .pm-score-input{ justify-content: center; }

  .pm-results-grid { grid-template-columns: 1fr 1fr; }

  .pm-fx-venue { display: none; }
  .pm-fx-teams { font-size: 12px; gap: 6px; }

  .pm-table thead th,
  .pm-table td { padding: 10px 10px; font-size: 12px; }
}

/* Mobile ≤ 480px */
@media (max-width: 480px) {
  .pm-wrap { margin-bottom: 32px; }
  .pm-header { padding: 16px 16px 14px; border-radius: 10px; }
  .pm-title   { font-size: 12pt; }
  .pm-subtitle{ font-size: 10pt; }

  .pm-match-card { padding: 12px 14px; }
  .pm-team-name  { font-size: 12px; }
  .pm-flag       { font-size: 20px; }
  .pm-score      { width: 44px; height: 40px; font-size: 18px; }
  .pm-btn-save   { font-size: 11px; padding: 8px 12px; }

  .pm-results-grid { grid-template-columns: 1fr; }

  .pm-fixture-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pm-fx-date     { font-size: 10px; }

  #pm-toast { right: 12px; bottom: 12px; left: 12px; text-align: center; }
}

/* Very small ≤ 360px */
@media (max-width: 360px) {
  .pm-title { font-size: 11pt; }
  .pm-score { width: 40px; height: 36px; font-size: 16px; }
}
