/* === Admin — Toolbar i Tabela === */

/* Toolbar */
.toolbar {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--page-padding) 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 36px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--sakura); }
.search::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
}
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 36px 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.select-wrap::after {
  content: "⌄";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-65%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

/* Bulk action bar */
.bulkbar {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--page-padding) 12px;
  display: none;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}
.bulkbar.active { display: flex; }
.bulkbar .count {
  background: var(--sakura-pale);
  color: #8a3357;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.bulkbar .sep { width: 1px; height: 16px; background: var(--line); }

/* Tabela */
.tablewrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--page-padding) 60px;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14px;
}
thead th {
  text-align: left;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th .arrow { color: var(--sakura); margin-left: 4px; }
thead th.checkcol { width: 36px; padding-right: 0; }
thead th.actcol { width: 100px; text-align: right; }
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sakura-pale); }
tbody tr.selected { background: var(--sakura-pale); }
tbody tr.editing { background: var(--sakura-pale); }
tbody tr.editing td { padding-top: 10px; padding-bottom: 10px; }
tbody td.name { font-weight: 500; }
tbody td.name .av {
  display: inline-flex;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sakura-soft), var(--sakura));
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  margin-right: 10px;
}
tbody td.entry { font-variant-numeric: tabular-nums; color: var(--muted); }
tbody td.email {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
tbody td.date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
tbody td.actcol { text-align: right; white-space: nowrap; }
tbody td.checkcol { padding-right: 0; }

/* Inline edit */
.cell-edit {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.cell-edit:focus { border-color: var(--sakura); }
.cell-edit.email { font-family: var(--font-mono); font-size: 12px; }
.cell-edit-row { display: flex; gap: 6px; }
.cell-edit-row .cell-edit { flex: 1; }
.cell-edit-row .cell-edit.bldg { max-width: 60px; }
.cell-edit-row .cell-edit.apt { max-width: 70px; }

/* Row actions */
.row-actions { display: inline-flex; gap: 4px; }
.iconbtn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn.save { color: var(--green); }
.iconbtn.save:hover { background: var(--green-soft); }
.iconbtn.del:hover { background: #fbe8ea; color: #a3343d; }
.iconbtn svg { width: 16px; height: 16px; }

/* Pager */
.pager {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px var(--page-padding) 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.pager .pages { display: flex; gap: 4px; }
.pager .pages button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  min-width: 32px;
}
.pager .pages button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pager .pages button:hover:not(.active) { border-color: var(--line-strong); }

/* Empty state */
.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .serif { font-size: 28px; color: var(--text); margin-bottom: 8px; display: block; }

/* Dialog za dodavanje */
.dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  padding: 36px;
  box-shadow: var(--shadow-overlay);
}
.dialog h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 36px;
  margin: 8px 0 6px;
  line-height: 1.1;
}
.dialog h2 em { font-style: italic; color: var(--sakura); }
.dialog .sub { color: var(--muted); font-size: 14px; margin: 0 0 28px; }
.dialog .field { margin-bottom: 18px; }
.dialog .field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.dialog .field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.dialog .field input:focus { border-color: var(--sakura); }
.dialog .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog .actions {
  margin-top: 28px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 800px) {
  .toolbar, .tablewrap, .pager, .bulkbar { padding-left: var(--page-padding); padding-right: var(--page-padding); }
  table thead th.entry-th,
  table thead th.date-th,
  table tbody td.entry,
  table tbody td.date { display: none; }
}
