/* Sportas visiems - admin panel styles.
   Palette + typography mirror the embeddable widget. */

:root {
  --sv-primary: #4B9194;
  --sv-primary-dark: #3f8184;
  --sv-primary-deep: #27686b;
  --sv-accent: #FFF56C;
  --sv-dark: #1D1E20;
  --sv-light: #EBEBE2;
  --sv-white: #FFFFFF;

  --cat-judejimo: #557DB8;
  --cat-raidos: #FFE66D;
  --cat-regejimo: #68A36C;
  --cat-klausos: #A982C4;
  --cat-visos: #4B9194;

  --bg: #e4e7dc;
  --panel: #ffffff;
  --ink: #1D1E20;
  --muted: rgba(29, 30, 32, .62);
  --line: rgba(29, 30, 32, .12);
  --line-soft: rgba(29, 30, 32, .08);
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 6px 18px rgba(29, 30, 32, .08);
  --shadow-md: 0 14px 36px rgba(29, 30, 32, .14);
  --shadow-lg: 0 24px 60px rgba(29, 30, 32, .26);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ok: #2f8f5b;
  --danger: #c0392b;
  --danger-bg: #fbeae8;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(75, 145, 148, .18), transparent 60%),
    radial-gradient(900px 500px at -5% 110%, rgba(255, 245, 108, .22), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.06;
}

button { font-family: inherit; }
a { color: var(--sv-primary-deep); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--sv-dark);
  color: var(--sv-white);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease), opacity .16s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid rgba(75, 145, 148, .5); outline-offset: 2px; }
.btn-primary { background: var(--sv-primary); }
.btn-primary:hover { background: var(--sv-primary-dark); }
.btn-accent { background: var(--sv-accent); color: var(--sv-dark); }
.btn-ghost { background: rgba(255, 255, 255, .8); color: var(--sv-dark); border-color: var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: var(--danger); }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: rgba(192, 57, 43, .35); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 13px; font-weight: 700; }
.btn-icon { min-height: 38px; width: 38px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(100%, 410px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 34px 30px 30px;
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 245, 108, .9);
  color: var(--sv-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.login-card h1 { font-size: 34px; margin: 16px 0 4px; }
.login-card h1 .mark { color: var(--sv-primary); }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card form { display: grid; gap: 14px; }

/* ------------------------------------------------------------------ inputs */
.field { display: grid; gap: 6px; }
.field > label, .field-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.input, .textarea, .select {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--sv-primary);
  box-shadow: 0 0 0 4px rgba(75, 145, 148, .18);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D1E20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.hint { font-size: 12px; color: var(--muted); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 700; }
.input-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(192, 57, 43, .14) !important; }

/* ------------------------------------------------------------------ app shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 16px;
  background: var(--sv-dark);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-logo {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--sv-primary);
  color: var(--sv-accent);
}
.brand-name { font-family: "Oswald", sans-serif; font-weight: 700; text-transform: uppercase; font-size: 18px; line-height: 1; }
.brand-name span { color: var(--sv-primary); }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, .55); letter-spacing: .04em; }

.nav { display: grid; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, .76);
  font-size: 14px; font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--sv-primary); color: #fff; }
.nav-item .count { margin-left: auto; font-size: 12px; opacity: .8; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); }
.who { font-size: 12px; color: rgba(255, 255, 255, .6); padding: 0 8px; }
.who b { color: #fff; font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 26px;
  background: rgba(235, 235, 226, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { font-size: 26px; }
.topbar .grow { flex: 1; }
.save-state { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.dot.dirty { background: #e0a30c; }
.content { padding: 24px 26px 80px; }

/* ------------------------------------------------------------------ toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 40px; }
.muted-count { color: var(--muted); font-size: 13.5px; font-weight: 700; white-space: nowrap; }

/* ------------------------------------------------------------------ cards / list */
.places { display: grid; gap: 12px; }
.place-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.place-card:hover { transform: translateY(-2px); border-color: rgba(75, 145, 148, .45); box-shadow: var(--shadow-md); }
.place-logo {
  width: 52px; height: 52px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--sv-light);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  color: rgba(29, 30, 32, .3);
}
.place-logo img { width: 100%; height: 100%; object-fit: contain; }
.place-main { min-width: 0; }
.place-title { font-size: 18px; line-height: 1.12; }
.place-meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--muted); font-size: 13px; }
.place-meta .sport { color: var(--sv-primary-deep); font-weight: 800; }
.place-actions { display: flex; gap: 8px; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  background: rgba(75, 145, 148, .14);
  color: var(--sv-primary-deep);
}
.chip-cat { color: #fff; }
.chip-cat.judejimo { background: var(--cat-judejimo); }
.chip-cat.raidos { background: var(--cat-raidos); color: var(--sv-dark); }
.chip-cat.regejimo { background: var(--cat-regejimo); }
.chip-cat.klausos { background: var(--cat-klausos); }
.chip-dark { background: rgba(29, 30, 32, .08); color: var(--sv-dark); }

.empty {
  text-align: center;
  padding: 56px 24px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty h2 { font-size: 24px; color: var(--ink); margin-bottom: 6px; }

/* ------------------------------------------------------------------ drawer */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 16, 17, .46);
  opacity: 0;
  animation: fadeIn .18s var(--ease) forwards;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: min(100%, 580px);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  animation: slideIn .26s var(--ease) forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideIn { to { transform: translateX(0); } }
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 22px; flex: 1; min-width: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.drawer-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.drawer-foot .grow { flex: 1; }

.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.section-title {
  font-family: "Oswald", sans-serif; text-transform: uppercase; font-weight: 600;
  font-size: 13px; letter-spacing: .06em; color: var(--sv-primary-deep);
  margin: 8px 0 -2px; padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.section-title:first-child { border-top: 0; padding-top: 0; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: border-color .14s var(--ease), background-color .14s var(--ease);
}
.check:hover { border-color: rgba(75, 145, 148, .5); }
.check input { width: 17px; height: 17px; accent-color: var(--sv-primary); flex: 0 0 auto; }
.check.on { background: rgba(75, 145, 148, .1); border-color: rgba(75, 145, 148, .55); }

.toggle { display: flex; align-items: center; gap: 11px; padding: 10px 0; }
.toggle input { width: 18px; height: 18px; accent-color: var(--sv-primary); }

/* logo uploader */
.logo-up { display: flex; gap: 16px; align-items: center; }
.logo-box {
  width: 110px; height: 110px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  color: rgba(29, 30, 32, .26);
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-up-actions { display: grid; gap: 8px; }
.logo-up-actions .hint { max-width: 280px; }

/* ------------------------------------------------------------------ schema editor */
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.panel-card > h2 { font-size: 19px; margin-bottom: 4px; }
.panel-card > .hint { margin-bottom: 14px; }
.kv-row { display: grid; grid-template-columns: 210px 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.kv-key { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 13px; letter-spacing: .03em; color: var(--muted); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.kv-key code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: none; }
.kv-add { display: grid; grid-template-columns: 210px 1fr auto; gap: 10px; margin-top: 12px; }

/* ------------------------------------------------------------------ backups */
.backup-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.backup-table th, .backup-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.backup-table th { font-family: "Oswald", sans-serif; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; color: var(--muted); background: rgba(235, 235, 226, .5); }
.backup-table tr:last-child td { border-bottom: 0; }
.backup-table td.actions { text-align: right; white-space: nowrap; }
.tag { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.tag.auto { background: rgba(75, 145, 148, .14); color: var(--sv-primary-deep); }
.tag.manual { background: rgba(255, 245, 108, .55); color: #6b5e00; }
.tag.prerestore { background: rgba(169, 130, 196, .2); color: #6c4a86; }

/* ------------------------------------------------------------------ embed */
.embed-grid { display: grid; gap: 16px; }
.code-block { position: relative; }
.code-block pre {
  margin: 0; padding: 14px 16px; padding-right: 52px;
  background: var(--sv-dark); color: #e9efe6;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.copy-btn { position: absolute; top: 10px; right: 10px; }

/* ------------------------------------------------------------------ toast */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
  padding: 12px 15px;
  background: var(--sv-dark); color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13.5px; font-weight: 600;
  animation: toastIn .22s var(--ease);
}
.toast.ok { background: #1f7a4d; }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ------------------------------------------------------------------ misc */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.center-spinner { display: grid; place-items: center; min-height: 60vh; }
.center-spinner .spinner { width: 30px; height: 30px; border-color: rgba(75,145,148,.25); border-top-color: var(--sv-primary); }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid rgba(75, 145, 148, .5); outline-offset: 2px; }

/* ------------------------------------------------------------------ responsive */
.menu-btn { display: none; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: 240px;
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .form-row, .check-grid { grid-template-columns: 1fr; }
  .kv-row, .kv-add { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 21px; }
  .content { padding: 18px 16px 70px; }
  .topbar { padding: 14px 16px; }
  .place-card { grid-template-columns: 44px 1fr; }
  .place-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
