/* Admin Panel — YouAndMe */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Zapobiegaj nadpisaniu atrybutu hidden przez klasy CSS z display: */
[hidden] { display: none !important; }

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --border:   #30363d;
  --text:     #e6edf3;
  --text-dim: #8b949e;
  --accent:   #58a6ff;
  --success:  #3fb950;
  --danger:   #f85149;
  --warn:     #d29922;
  --radius:   8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Login ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text-dim); margin-bottom: 24px; font-size: 13px; }

/* ── Header ── */
.admin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-title { font-weight: 600; font-size: 16px; }
.admin-user  { color: var(--text-dim); font-size: 13px; flex: 1; }

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Main ── */
.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 16px; }

/* ── Add form ── */
.add-form {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.add-form h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  align-self: end;
  padding-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}

input:focus { border-color: var(--accent); }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ── Buttons ── */
button, .btn-link {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  transition: opacity .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover, .btn-link:hover { opacity: .82; }

.btn-primary   { background: var(--accent);   color: #000; }
.btn-secondary { background: var(--border);   color: var(--text); }
.btn-danger    { background: var(--danger);   color: #fff; }
.btn-warn      { background: var(--warn);     color: #000; font-size: 12px; padding: 5px 10px; }
.btn-ghost     { background: transparent; border: 1px solid var(--border); color: var(--text-dim); font-size: 12px; padding: 5px 10px; }
.btn-link      { background: transparent; color: var(--accent); }

/* ── Table ── */
#users-table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.03); }

td { padding: 10px 10px; vertical-align: middle; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active   { background: rgba(63,185,80,.2);  color: var(--success); }
.badge-inactive { background: rgba(248,81,73,.15); color: var(--danger); }
.badge-admin    { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-user     { background: rgba(139,148,158,.15); color: var(--text-dim); }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Overlay / dialog ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.dialog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
}

.dialog-card h3 { font-size: 16px; margin-bottom: 6px; }
.dialog-subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }

.dialog-card label {
  margin-bottom: 12px;
}

/* ── Error msg ── */
.error-msg {
  background: rgba(248,81,73,.12);
  border: 1px solid rgba(248,81,73,.4);
  border-radius: 6px;
  color: var(--danger);
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 8px;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #238636;
  color: #fff;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}

#toast.visible { opacity: 1; }
