/* ─── Admin-specific styles ─ uses theme.css tokens ───────────────────────── */

/* Brand badge in header */
.brand__badge {
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.admin-main {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px;
  position: relative;
  z-index: 2;
}

.pane__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.pane__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pane__sub { margin-top: 6px; font-size: 12px; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn--primary {
  background: var(--accent);
  color: #0d0d0f;
  font-weight: 600;
  border: 1px solid var(--accent);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger {
  background: #e53935;
  color: #fff;
  border: 1px solid #e53935;
}
.btn--danger:hover { filter: brightness(1.08); }
.btn--full { width: 100%; justify-content: center; }
.btn--sm   { padding: 6px 10px; font-size: 12.5px; }

/* ─── Table ─────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table thead th {
  background: var(--bg-elev);
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--card-hover); }

.th-preview, .td-preview { width: 88px; }
.th-actions, .td-actions { width: 1%; white-space: nowrap; }
.th-active, .td-active   { width: 92px; text-align: center; }
.th-url   { width: 24%; }
.th-color { width: 48px; }
.th-slug  { width: 30%; }

.row-thumb {
  width: 64px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  object-fit: cover;
  display: block;
}
.row-thumb--placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 16px;
}
.row-name { font-weight: 600; }
.row-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  display: inline-block;
  white-space: nowrap;
  vertical-align: middle;
}
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.row-tag {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  background: var(--bg-elev);
}
.color-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-block;
}

.row-actions {
  display: flex; gap: 4px; justify-content: flex-end;
}
.action-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
  font-size: 14px;
}
.action-btn:hover { background: var(--bg-elev); color: var(--text); }
.action-btn--danger:hover { color: #e53935; }

.empty-row {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ─── Switch ────────────────────────────────────────────────────────────── */
.switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 36px; height: 20px;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background var(--transition);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch__label { font-size: 13px; color: var(--text-dim); }
.switch--compact { gap: 0; }
.switch--compact .switch__label { display: none; }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 5, 8, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 180ms ease both;
}
.modal__dialog {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 600px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px -16px rgba(0,0,0,0.5);
  animation: modalPop 220ms cubic-bezier(.4,.0,.2,1) both;
}
.modal__dialog--sm { max-width: 440px; }

.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal__title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em;
}
.modal__head .icon-btn { font-size: 20px; line-height: 1; color: var(--muted); }

.modal__body {
  padding: 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}

.modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ─── Form fields ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 500;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field input[type="password"],
.field textarea,
.input-tight {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field textarea { resize: vertical; min-height: 60px; font-family: var(--font-sans); }
.field input:focus, .field textarea:focus, .input-tight:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--inline .field__label { margin: 0; min-width: auto; }
.field--inline input { width: 80px; }
.input-color {
  width: 56px; height: 36px; padding: 2px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.field-row {
  display: flex; gap: 24px; align-items: center;
  flex-wrap: wrap;
}

.hint { font-size: 11px; margin-top: 4px; }
.form-error {
  padding: 8px 12px;
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: var(--radius-md);
  color: #e53935;
  font-size: 13px;
}

/* ─── Preview control inside service form ──────────────────────────────── */
.preview-control { display: flex; flex-direction: column; gap: 10px; }
.preview-box {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.preview-box img { width: 100%; height: 100%; object-fit: cover; }
.preview-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview-actions .input-tight { flex: 1; min-width: 200px; }

/* ─── Tag picker ────────────────────────────────────────────────────────── */
.tag-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 36px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tag-picker__chip {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.tag-picker__chip:hover { border-color: var(--border-strong); color: var(--text); }
.tag-picker__chip[data-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.tag-picker__empty {
  font-size: 12px; color: var(--muted); padding: 4px;
}

/* ─── Login view ────────────────────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative; z-index: 2;
}
.login__card {
  width: 100%; max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 16px;
}
.brand--login {
  align-self: center;
  font-size: 22px;
  margin-bottom: 4px;
}
.login__title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}
.login__sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.login__form { display: flex; flex-direction: column; gap: 12px; }
.login__error {
  padding: 8px 12px;
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: var(--radius-md);
  color: #e53935;
  font-size: 13px;
}
.login__back {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
  transition: color var(--transition);
}
.login__back:hover { color: var(--text); }

/* ─── Toasts ────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  min-width: 240px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.3);
  animation: toastIn 220ms cubic-bezier(.4,.0,.2,1) both;
  pointer-events: auto;
}
.toast--error   { border-left-color: #e53935; }
.toast--success { border-left-color: #22c55e; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.confirm-text { font-size: 14px; color: var(--text-dim); }

/* ─── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .admin-main { padding: 24px 16px; }
  .header__inner { padding: 12px 16px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .th-url, .td-url { display: none; }
  .th-slug, .td-slug { display: none; }
  .row-url { max-width: 160px; }
  .pane__head { flex-direction: column; align-items: stretch; gap: 12px; }
}
