:root {
  --bg: #f4f7f4;
  --card: #ffffff;
  --text: #182018;
  --muted: #5f6b5f;
  --brand: #1f6f43;
  --brand-strong: #195836;
  --danger: #aa3030;
  --border: #d9e3d9;
}

html[data-theme="dark"] {
  --bg: #121814;
  --card: #1a231d;
  --text: #e7f1e7;
  --muted: #a8b5a8;
  --brand: #35a064;
  --brand-strong: #2a8753;
  --danger: #cf6f6f;
  --border: #2b3830;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    linear-gradient(rgba(8, 14, 12, 0.35), rgba(8, 14, 12, 0.35)),
    url("/static/volleyball-gradient-background.jpg") center center / cover no-repeat fixed;
  color: var(--text);
}

.topbar {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
}
.logo { font-weight: 700; }
.container {
  max-width: 1040px;
  margin: 20px auto;
  padding: 0 16px;
}
.card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(7px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

html[data-theme="dark"] .topbar {
  background: rgba(18, 24, 20, 0.72);
}

html[data-theme="dark"] .card {
  background: rgba(20, 30, 24, 0.72);
}
.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 840px) {
  .grid-two { grid-template-columns: 1fr; }
}
label { display: block; margin: 8px 0 4px; }
input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
}
.btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: #355c9c; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--brand); }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.flash-stack { margin-bottom: 16px; }
.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.flash-success { background: #d8f0df; color: #0f4424; }
.flash-error { background: #f4d7d7; color: #6b1f1f; }
.flash-info { background: #dce7fa; color: #243f70; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; }
.match-admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.badge-cancel {
  background: #f6dada;
  color: #8a2a2a;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
}
.level-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 8px;
}
.level-halado { background: #fdecc8; color: #6f4d0b; }
.level-amator { background: #d8f0ff; color: #0a4d66; }
.match-progress { margin-top: 12px; }
.progress-bar { height: 10px; border-radius: 999px; overflow: hidden; background: var(--border); }
.progress-fill { height: 10px; background: var(--brand); }
.match-details {
  margin: 10px 0;
  padding-left: 20px;
  line-height: 1.5;
}
.match-details li {
  margin: 6px 0;
}
.progress-label {
  display: inline-block;
  margin-top: 8px;
  line-height: 1.4;
}
.match-actions {
  margin-top: 10px;
}

.match-actions.booked-state {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.match-actions.booked-state form {
  margin: 0;
}

.badge-you-booked {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 111, 67, 0.14);
  border: 1px solid rgba(31, 111, 67, 0.3);
  color: var(--brand-strong);
  font-weight: 600;
}

.token-entry {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.token-actions {
  margin-top: 10px;
}

.token-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 640px) {
  .match-details {
    padding-left: 22px;
    line-height: 1.65;
  }

  .match-details li {
    margin: 8px 0;
  }

  .match-progress {
    margin-top: 14px;
  }

  .match-actions {
    margin-top: 14px;
  }

  .match-actions.booked-state {
    align-items: stretch;
  }

  .match-actions.booked-state .btn,
  .match-actions.booked-state .badge-you-booked {
    width: 100%;
    justify-content: center;
  }
}
.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 4px 8px;
  cursor: pointer;
}

.install-app-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 50;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.install-app-btn:hover {
  background: var(--brand-strong);
}
html[data-theme="light"] .icon-dark,
html[data-theme="light"] .icon-auto,
html[data-theme="dark"] .icon-light,
html[data-theme="dark"] .icon-auto,
html[data-theme="auto"] .icon-light,
html[data-theme="auto"] .icon-dark { display: none; }
