/* ================================================================
   Vandpolo Landshold — vpl.css v3.0
   #be1f28 red theme. Modals live in #vpl-portal at body level.
   ================================================================ */

/* ── WIDGET WRAPPER ─────────────────────────────────────────── */
.vpl-widget {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  color: #222;
  background: #f3f4f6;
  border-radius: 10px;
  max-width: 960px;
  margin: 0 auto;
  box-shadow: 0 2px 16px rgba(0,0,0,.10);
}

/* ── GEAR BUTTON ────────────────────────────────────────────── */
.vpl-gear-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.18);
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: background .15s, color .15s;
  padding: 0;
}
.vpl-gear-btn:hover { background: rgba(255,255,255,.32); color: #fff; }
.vpl-gear-btn--active { color: #fff; background: rgba(255,255,255,.25); }

/* ── HEADER ─────────────────────────────────────────────────── */
.vpl-header {
  background: #be1f28;
  padding: 24px 24px 20px;
  border-radius: 10px 10px 0 0;
}
.vpl-header-eyebrow {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.6);
  margin: 0 0 6px;
  font-weight: 600;
}
.vpl-header-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -.3px;
  line-height: 1.1;
}
.vpl-header-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.7);
  margin: 0;
}

/* ── TABS ───────────────────────────────────────────────────── */
.vpl-tabs {
  display: flex;
  background: #8c1520;
  padding: 0 20px;
  gap: 2px;
}
.vpl-tab {
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.45);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .15s, border-color .15s;
}
.vpl-tab:hover { color: rgba(255,255,255,.8); }
.vpl-tab--active { color: #fff; border-bottom-color: #fff; }
.vpl-tab-count {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.vpl-tab--active .vpl-tab-count { background: #fff; color: #8c1520; }

/* ── PANELS ─────────────────────────────────────────────────── */
.vpl-panel { padding: 18px; }
.vpl-panel--hidden { display: none; }

/* ── MATCH GRID ─────────────────────────────────────────────── */
.vpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 12px;
}

/* ── MATCH CARD ─────────────────────────────────────────────── */
.vpl-card {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.vpl-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.10); transform: translateY(-1px); }

.vpl-card-head {
  padding: 8px 14px 6px;
  font-size: .71rem;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.vpl-card-head-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 2px;
}
.vpl-card-head-name { color: #555; }

.vpl-card-body {
  padding: 13px 14px;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.vpl-card-teams {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.vpl-card-team {
  display: flex;
  align-items: center;
  gap: 9px;
}
.vpl-card-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #e2e4e8;
  background: #f5f5f6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .62rem;
  color: #be1f28;
  overflow: hidden;
}
.vpl-card-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vpl-card-team-name { font-weight: 600; font-size: .93rem; color: #1a1a1a; }

.vpl-card-divider { width: 1px; background: #e2e4e8; margin: 0 14px; flex-shrink: 0; }

.vpl-card-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 80px;
  flex-shrink: 0;
  text-align: center;
}
.vpl-card-time { font-size: 1.3rem; font-weight: 700; color: #1a1a1a; letter-spacing: -.5px; }
.vpl-card-score-wrap { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.vpl-card-score-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.vpl-card-label {
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #999;
}
.vpl-card-label--final { color: #be1f28; }

.vpl-card-foot {
  padding: 7px 14px 9px;
  font-size: .72rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 5px;
  border-top: 1px solid #f0f2f5;
}
.vpl-card-foot svg { flex-shrink: 0; opacity: .5; }

/* ── SKELETON ───────────────────────────────────────────────── */
.vpl-skeleton {
  background: linear-gradient(90deg, #e8eaed 25%, #f3f4f6 50%, #e8eaed 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  height: 110px;
  animation: vpl-shimmer 1.4s ease-in-out infinite;
}
@keyframes vpl-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── EMPTY ──────────────────────────────────────────────────── */
.vpl-empty {
  text-align: center;
  padding: 48px 20px;
  grid-column: 1 / -1;
}
.vpl-empty-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; opacity: .35; }
.vpl-empty-title { font-weight: 700; font-size: .95rem; color: #444; margin: 0 0 4px; }
.vpl-empty-text { font-size: .82rem; color: #999; margin: 0; }

/* ── EDITOR ─────────────────────────────────────────────────── */
.vpl-editor { background: #f3f4f6; border-radius: 0 0 10px 10px; }
.vpl-editor[hidden] { display: none; }

.vpl-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #8c1520;
  color: #fff;
  padding: 12px 18px;
}
.vpl-editor-topbar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: .88rem;
  color: #fff;
}
.vpl-editor-topbar-actions { display: flex; gap: 7px; }

.vpl-editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 16px;
  background: #fff;
  border-bottom: 1px solid #e2e4e8;
}
.vpl-filter-group { display: flex; gap: 4px; margin-left: auto; }
.vpl-filter {
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: transparent;
  color: #666;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .14s;
}
.vpl-filter:hover, .vpl-filter--active { background: #be1f28; border-color: #be1f28; color: #fff; }

.vpl-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.vpl-search-wrap > svg { position: absolute; left: 9px; color: #aaa; pointer-events: none; }
.vpl-search {
  padding: 7px 10px 7px 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .8rem;
  font-family: inherit;
  color: #222;
  width: 185px;
  background: #fff;
  transition: border-color .14s;
}
.vpl-search:focus { outline: none; border-color: #be1f28; box-shadow: 0 0 0 3px rgba(190,31,40,.1); }

.vpl-editor-list {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

/* ── EDITOR MATCH ROW ───────────────────────────────────────── */
.vpl-erow {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  transition: box-shadow .14s;
}
.vpl-erow:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.vpl-erow-drag { color: #ccc; cursor: grab; font-size: 1rem; flex-shrink: 0; user-select: none; line-height: 1; }
.vpl-erow-drag:active { cursor: grabbing; }
.vpl-erow-body { flex: 1; min-width: 0; }
.vpl-erow-title { font-size: .85rem; font-weight: 700; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpl-erow-title span { color: #aaa; font-weight: 400; margin: 0 5px; font-size: .8rem; }
.vpl-erow-meta { font-size: .73rem; color: #999; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpl-erow-badge {
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}
.vpl-erow-badge--upcoming { background: rgba(5,150,105,.1); color: #059669; }
.vpl-erow-badge--final    { background: rgba(190,31,40,.1);  color: #be1f28; }
.vpl-erow-btns { display: flex; gap: 4px; flex-shrink: 0; }
.vpl-erow-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #e2e4e8;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  transition: .14s;
  padding: 0;
  font-size: .8rem;
}
.vpl-erow-btn:hover { background: #fdf0f0; border-color: #be1f28; color: #be1f28; }
.vpl-erow-btn--del:hover { background: rgba(220,38,38,.07); border-color: #dc2626; color: #dc2626; }
.vpl-erow--dragging { opacity: .4; }
.vpl-erow--dragover { border-color: #be1f28; background: #fdf8f8; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.vpl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 15px;
  border-radius: 6px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .14s;
  white-space: nowrap;
  line-height: 1.3;
}
.vpl-btn:active { transform: scale(.97); }
.vpl-btn:focus-visible { outline: 2px solid #be1f28; outline-offset: 2px; }
.vpl-btn--primary { background: #be1f28; color: #fff; border-color: #be1f28; }
.vpl-btn--primary:hover { background: #8c1520; border-color: #8c1520; }
/* Ghost used on dark (topbar) and light (toolbar) backgrounds */
.vpl-btn--ghost { background: transparent; color: rgba(255,255,255,.7); border-color: transparent; }
.vpl-btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
/* Override ghost when on white background */
.vpl-editor-toolbar .vpl-btn--ghost,
.vpl-modal-footer .vpl-btn--ghost {
  color: #555;
  border-color: #d1d5db;
}
.vpl-editor-toolbar .vpl-btn--ghost:hover,
.vpl-modal-footer .vpl-btn--ghost:hover {
  background: #f3f4f6;
  color: #222;
}
.vpl-btn--outline { background: transparent; color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.35); }
.vpl-btn--outline:hover { background: rgba(255,255,255,.1); color: #fff; }
.vpl-btn--danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.vpl-btn--danger:hover { background: #b91c1c; }
.vpl-btn--sm { padding: 5px 10px; font-size: .76rem; }
.vpl-btn--full { width: 100%; justify-content: center; }
.vpl-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── PORTAL — modals appended to <body> via JS ──────────────── */
#vpl-portal { position: fixed; inset: 0; z-index: 999999; pointer-events: none; }
#vpl-portal:empty { display: none; }

/* ── MODAL ──────────────────────────────────────────────────── */
.vpl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999999;
  pointer-events: all;
  animation: vpl-fade-in .18s ease;
}
@keyframes vpl-fade-in { from{opacity:0} to{opacity:1} }

.vpl-modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  position: relative;
  animation: vpl-slide-up .2s ease;
  pointer-events: all;
}
.vpl-modal--wide { max-width: 700px; }
.vpl-modal--sm   { max-width: 360px; }
@keyframes vpl-slide-up { from{opacity:0;transform:translateY(16px) scale(.97)} to{opacity:1;transform:none} }

.vpl-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  font-family: inherit;
  line-height: 1;
  transition: .14s;
  padding: 0;
}
.vpl-modal-close:hover { background: #e2e4e8; color: #222; }

.vpl-modal-header { text-align: center; margin-bottom: 20px; }
.vpl-modal-icon {
  width: 54px;
  height: 54px;
  background: #be1f28;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.vpl-modal-title { font-size: 1.1rem; font-weight: 800; color: #1a1a1a; margin: 0 0 5px; }
.vpl-modal-subtitle { font-size: .83rem; color: #888; margin: 0; }
.vpl-modal-error {
  background: #fdf2f2;
  border: 1px solid rgba(220,38,38,.25);
  color: #dc2626;
  padding: 9px 13px;
  border-radius: 6px;
  font-size: .8rem;
  margin-bottom: 14px;
  display: none;
}
.vpl-modal-error--visible { display: block; }

.vpl-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  margin-top: 16px;
  border-top: 1px solid #e2e4e8;
}

/* ── FORM ───────────────────────────────────────────────────── */
.vpl-form-section {
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 14px;
}
.vpl-form-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #be1f28;
  margin: 0 0 12px;
}
.vpl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vpl-form-row--single { grid-template-columns: 1fr; }
.vpl-form-group { display: flex; flex-direction: column; gap: 4px; }
.vpl-form-group--wide { grid-column: 1 / -1; }
.vpl-label { font-size: .78rem; font-weight: 600; color: #333; }
.vpl-input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  font-size: .88rem;
  color: #222;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .14s, box-shadow .14s;
  -webkit-appearance: none;
}
.vpl-input:focus {
  outline: none;
  border-color: #be1f28;
  box-shadow: 0 0 0 3px rgba(190,31,40,.12);
}
.vpl-input::placeholder { color: #aab; }
.vpl-input--score { font-size: 1.4rem; font-weight: 800; text-align: center; padding: 8px 4px; }
select.vpl-input { cursor: pointer; }

.vpl-logo-field { display: flex; align-items: center; gap: 6px; }
.vpl-logo-field .vpl-input { flex: 1; min-width: 0; }
.vpl-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #f3f4f6;
  color: #555;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: .14s;
  flex-shrink: 0;
  font-family: inherit;
}
.vpl-upload-label:hover { background: #e2e4e8; border-color: #aaa; }
.vpl-upload-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.vpl-logo-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e2e4e8;
  background: #f3f4f6;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  color: #aaa;
}
.vpl-logo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.vpl-score-pair { display: flex; align-items: flex-end; gap: 10px; }
.vpl-score-pair > .vpl-form-group { flex: 1; }
.vpl-score-dash { font-size: 1.5rem; font-weight: 300; color: #bbb; padding-bottom: 8px; flex-shrink: 0; }

/* ── TOAST ──────────────────────────────────────────────────── */
.vpl-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999999;
  background: #1a1a1a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  border-left: 4px solid #be1f28;
  max-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: vpl-slide-up .2s ease;
}
.vpl-toast--success { border-left-color: #059669; }
.vpl-toast--info    { border-left-color: #6366f1; }
.vpl-toast--error   { border-left-color: #dc2626; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .vpl-grid { grid-template-columns: 1fr; }
  .vpl-form-row { grid-template-columns: 1fr; }
  .vpl-form-group--wide { grid-column: 1; }
  .vpl-editor-toolbar { flex-direction: column; align-items: stretch; }
  .vpl-filter-group { margin-left: 0; }
  .vpl-search { width: 100%; }
  .vpl-modal { padding: 20px 16px 18px; }
  .vpl-modal-footer { flex-direction: column-reverse; }
  .vpl-modal-footer .vpl-btn { width: 100%; justify-content: center; }
  .vpl-header { padding: 18px 16px 16px; }
}

/* ── FLAG PICKER ────────────────────────────────────────────── */
.vpl-flag-search { margin-bottom: 10px; }

.vpl-flag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}
.vpl-flag-grid::-webkit-scrollbar { width: 5px; }
.vpl-flag-grid::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 3px; }
.vpl-flag-grid::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.vpl-flag-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 5px;
  border: 1.5px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}
.vpl-flag-item:hover { background: #f3f4f6; border-color: #e2e4e8; }
.vpl-flag-item--selected { background: #fdf0f0; border-color: #be1f28; }
.vpl-flag-emoji { font-size: 1.5rem; line-height: 1; }
.vpl-flag-label { font-size: .6rem; color: #888; text-align: center; line-height: 1.2; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Flag trigger button in edit form */
.vpl-flag-row { display: flex; align-items: center; }
.vpl-flag-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px dashed #d1d5db;
  border-radius: 6px;
  background: #fafafa;
  color: #888;
  font-size: .84rem;
  cursor: pointer;
  font-family: inherit;
  transition: .14s;
  width: 100%;
  justify-content: center;
}
.vpl-flag-trigger:hover { border-color: #be1f28; color: #be1f28; background: #fdf8f8; }
.vpl-flag-trigger--set {
  border-style: solid;
  border-color: #e2e4e8;
  background: #fff;
  color: #1a1a1a;
  font-size: 1.1rem;
  justify-content: flex-start;
  padding: 6px 10px;
}
.vpl-flag-trigger--set span { font-size: .76rem; color: #999; margin-left: auto; }
.vpl-flag-trigger--set:hover { border-color: #be1f28; }

/* Flag display in match cards */
.vpl-card-logo--flag { font-size: 1.3rem; line-height: 1; background: transparent; border: none; }
