/* ============================================================
   General.css — Shared styles across ALL BotKinar pages
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #09061e;
  --surface:    #120e35;
  --surface2:   #1c1550;
  --border:     #2e2080;
  --accent:     #7b30f0;
  --accent2:    #f1c40f;
  --text:       #e8e0ff;
  --muted:      #7868a8;
  --text-muted: #7868a8;
  --green:      #2ecc71;
  --red:        #e74c3c;
  --orange:     #f39c12;
  --gold:       #f1c40f;
  --silver:     #bdc3c7;
  --bronze:     #cd7f32;
  --purple:     #7b30f0;
  --cyan:       #00d4ff;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* --- Buttons --- */
.btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all .15s;
}
.btn-primary, .btn-prim {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover, .btn-prim:hover { background: var(--accent2); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent2); }

.btn-danger, .btn-red {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover, .btn-red:hover { background: #c0392b; }

.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-success:hover { background: #27ae60; }

.btn-warn {
  background: var(--orange);
  color: #fff;
}
.btn-warn:hover { background: #d35400; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.85rem;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent2); }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.card-title {
  padding: 14px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* --- Form rows --- */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; min-height: 80px; }
option { background: var(--surface2); }

/* --- Badges / Status pills --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-blue  { background: rgba(123,48,240,.18); color: var(--cyan); }
.badge-gray, .badge-grey  { background: rgba(255,255,255,.08); color: var(--muted); }
.badge-green { background: rgba(46,204,113,.18); color: var(--green); }
.badge-red   { background: rgba(231,76,60,.18);  color: var(--red); }
.badge-orange { background: rgba(230,126,34,.18); color: var(--orange); }
.badge-purple { background: rgba(155,89,182,.18); color: var(--purple); }

/* --- Stat boxes --- */
.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
}
.stat-box .val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent2);
  line-height: 1;
}
.stat-box .lbl {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}
.pagination button, .page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .15s;
}
.pagination button:hover:not(:disabled),
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent2); }
.pagination button:disabled, .page-btn:disabled { opacity: .4; cursor: default; }
.pagination .page-info, .page-info { color: var(--muted); font-size: 0.85rem; }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all .15s;
}
.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active {
  background: rgba(123,48,240,.2);
  border-color: var(--accent);
  color: #e8e0ff;
}

/* --- Toast — type 1: single #toast block/none --- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 11px 18px;
  border-radius: 9px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  z-index: 500;
  display: none;
  animation: toastFadeIn .2s;
}
#toast.ok  { border-color: rgba(46,204,113,.4); color: var(--green); }
#toast.err { border-color: rgba(231,76,60,.4);  color: var(--red); }

/* Toast — type 2: #toast-container with stacked toasts */
#toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 200;
}
.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: toastFadeIn .2s;
}
.toast-success { background: #1a3a28; border: 1px solid var(--green); color: var(--green); }
.toast-error   { background: #3a1a1a; border: 1px solid var(--red);   color: var(--red); }
.toast-warn    { background: #3a2a0a; border: 1px solid var(--orange); color: var(--orange); }

/* Toast — type 3: opacity transition + .show class */
.toast-opacity {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 999;
}
.toast-opacity.show { opacity: 1; }
.toast-opacity.ok  { border-color: var(--green); color: var(--green); }
.toast-opacity.err { border-color: var(--red);   color: var(--red); }

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

/* --- Modals — type 1: display:none / display:flex toggle --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

/* Modals — type 2: opacity:0 → 1 with .open class */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

/* Modal — generic .modal-bg (simple overlay) */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-head, .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 20px; flex: 1; overflow-y: auto; }
.modal-foot, .modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }

/* --- CSS Toggle switch (checkbox) --- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.slider-toggle::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .slider-toggle { background: var(--accent); }
.switch input:checked + .slider-toggle::before { transform: translateX(20px); }

/* --- Ranking rows --- */
.ranking { display: flex; flex-direction: column; gap: 2px; }
.ranking-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  transition: background .1s;
}
.ranking-row:hover { background: var(--surface2); }
.rank { font-size: 0.85rem; font-weight: 700; min-width: 28px; text-align: center; }
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }
.rank-other { color: var(--muted); }
.player-name { flex: 1; font-weight: 600; font-size: 0.92rem; }
.score-cols { display: flex; gap: 18px; }
.score-item { text-align: right; }
.score-val { font-size: 0.92rem; font-weight: 700; color: #fff; }
.score-lbl { font-size: 0.7rem; color: var(--muted); }

/* --- Loading / empty states --- */
.loading { color: var(--muted); padding: 40px; text-align: center; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 0.9rem; }

/* --- Form grid (2-col) --- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .form-full, .form-full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
