/* ============================================================
   Admin page styles (loaded after styles.css)
   ============================================================ */
.admin-body main { padding-bottom: 60px; }
/* Classes below set their own display, so make the hidden attribute win. */
.admin-body [hidden] { display: none !important; }
.admin-tag {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--primary-soft); color: var(--primary); padding: 3px 8px; border-radius: 999px; margin-left: 4px;
}
.admin-actions { display: flex; gap: 8px; align-items: center; }
.admin-center { min-height: calc(100vh - 64px - 60px); display: grid; place-items: center; padding: 40px 0; }
.login-panel { width: 100%; max-width: 420px; display: grid; gap: 14px; }
.login-panel h1 { margin: 0; font-size: 1.5rem; }
.login-panel p { margin: 0; }
.muted { color: var(--text-muted); }
.hint { font-weight: 400; color: var(--text-muted); font-size: .8rem; }
.code {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: .85rem; overflow-x: auto; margin: 0; color: var(--text);
}

.admin-head { padding: 36px 0 20px; }
.admin-head h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -0.02em; }
.admin-head p { margin: 0; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 14px; font-weight: 600; color: var(--text-muted); white-space: nowrap; font-size: .95rem;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { font-weight: 400; opacity: .7; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-toolbar .search-wrap { max-width: 420px; }
.admin-toolbar p { margin: 0; flex: 1 1 320px; font-size: .92rem; }

/* Tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; background: var(--surface-alt); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-alt); }
.table td.name a { color: var(--text); font-weight: 600; }
.table td.name a:hover { color: var(--primary); text-decoration: none; }
.table td.name small { display: block; color: var(--text-muted); font-weight: 400; }
.table td.truncate { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions-col { width: 1%; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn-danger { background: transparent; border-color: var(--border); color: var(--danger); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); background: rgba(198, 40, 40, .06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.cat-icon-cell { font-size: 1.2rem; width: 1%; }
.table .empty-row td { text-align: center; color: var(--text-muted); padding: 40px; }

/* Forms */
.settings-form { display: grid; gap: 14px; max-width: 760px; }
.settings-form h2, .panel h2 { margin: 0 0 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.two-col .panel { display: grid; gap: 14px; }
.form-error {
  background: rgba(198, 40, 40, .08); border: 1px solid rgba(198, 40, 40, .3); color: var(--danger);
  border-radius: 10px; padding: 10px 12px; font-size: .9rem;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 15, 30, .55); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: 100%; max-width: 760px; max-height: calc(100vh - 40px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-hover); display: flex; flex-direction: column; animation: fadeUp .2s ease;
}
.modal-sm { max-width: 520px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.icon-btn { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--text-muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px;
  font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-hover); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 200; max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .admin-actions .btn { padding: 8px 10px; font-size: .85rem; }
  .table th:nth-child(4), .table td:nth-child(4), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}
