/* =====================================================================
   Panel administratora - osobny arkusz (nie modyfikuje assets/css/styles.css).
   Paleta zgodna z motywem strony glownej (jasny/ciemny automatycznie).
   ===================================================================== */
:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #eef1f7;
  --text: #171923;
  --text-muted: #687083;
  --border: #dfe3ec;
  --accent: #7c5cff;
  --accent-strong: #6545ed;
  --accent-soft: #eeeaff;
  --green: #2dbd86;
  --red: #e0566f;
  --shadow: 0 18px 50px rgba(35, 42, 68, 0.1);
  --radius-lg: 18px;
  --radius-md: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #181b24;
    --surface-soft: #20242f;
    --text: #f2f3f7;
    --text-muted: #9ba3b6;
    --border: #2b303d;
    --accent: #8b72ff;
    --accent-strong: #9c87ff;
    --accent-soft: #29243e;
    --green: #3bd49b;
    --red: #f0728a;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
svg { display: block; width: 1.25em; fill: currentColor; }

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* --------------------------- przyciski --------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .95rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-soft);
  transition: filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--red); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
.btn-mini { padding: .35rem .6rem; font-size: .82rem; }

/* --------------------------- logowanie --------------------------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  display: grid;
  gap: 1rem;
}
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: .25rem; }
.login-brand strong { display: block; font-size: 1.05rem; }
.login-brand small { color: var(--text-muted); }
.login-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.login-mark svg { width: 22px; }
.login-mark.sm { width: 34px; height: 34px; }
.login-mark.sm svg { width: 18px; }

/* --------------------------- formularze -------------------------- */
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; font-size: .88rem; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: .6rem .75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
}
.field textarea { resize: vertical; }
.hint { color: var(--text-muted); font-size: .78rem; font-weight: 400; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; cursor: pointer; }
.checkbox.inline { font-weight: 500; }
.checkbox input { width: 18px; height: 18px; }
.form-error { color: var(--red); font-size: .88rem; margin: 0; }
.form-ok { color: var(--green); font-size: .88rem; margin: 0; }

/* --------------------------- panel ------------------------------- */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.admin-title { display: flex; align-items: center; gap: .65rem; }
.admin-title strong { display: block; font-size: .98rem; }
.admin-title small { color: var(--text-muted); font-size: .8rem; }
.admin-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.admin-main { padding: 1.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.admin-toolbar h1 { font-size: 1.4rem; margin: 0; }
.toolbar-right { display: flex; gap: .6rem; flex-wrap: wrap; }
.toolbar-right input[type="search"] {
  padding: .55rem .8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  min-width: 200px;
}
.status-line { color: var(--text-muted); font-size: .9rem; min-height: 1.2em; margin: 0 0 .75rem; }

/* --------------------------- tabela ------------------------------ */
.project-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.project-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.project-table th, .project-table td {
  text-align: left;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
  vertical-align: middle;
}
.project-table thead th {
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.project-table tbody tr:last-child td { border-bottom: none; }
.project-table tbody tr.is-hidden { opacity: .55; }
.cell-name { display: flex; align-items: center; gap: .65rem; }
.cell-thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-soft);
  flex: none;
}
.cell-name b { display: block; }
.cell-name small { color: var(--text-muted); font-size: .78rem; }
.col-akcje { text-align: right; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--text-muted);
}
.badge.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }

.switch { position: relative; display: inline-flex; width: 42px; height: 24px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background .15s ease;
}
.switch .track::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* --------------------------- modale ------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 12, 18, .5);
  display: grid;
  place-items: center;
  padding: 1.25rem;
  z-index: 20;
}
.modal {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.modal-sm { max-width: 440px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.icon-x {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 .25rem;
}
.modal-body { padding: 1.25rem; display: grid; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
  margin-top: .25rem;
  padding-top: 1rem;
}

/* --------------------------- linki ------------------------------- */
.links-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--surface-soft);
  display: grid;
  gap: .75rem;
}
.links-section h3 { margin: 0; font-size: 1rem; }
.links-list { display: grid; gap: .5rem; }
.link-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .55rem .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.link-row .link-main { flex: 1; min-width: 160px; }
.link-row .link-main b { display: block; font-size: .9rem; }
.link-row .link-main small { color: var(--text-muted); font-size: .78rem; word-break: break-all; }
.link-add-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.link-add-row input[type="text"] {
  flex: 1; min-width: 140px;
  padding: .5rem .65rem;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .admin-title small { display: none; }
}
