/* ==========================================================================
   DBR Admin Panel — additive styles only (uses tokens from style.css)
   ========================================================================== */

.admin { display: flex; min-height: 100vh; background: var(--gray-bg); }

/* Sidebar ------------------------------------------------------------------ */
.adm-side {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 264px;
  background: var(--white);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform 0.32s ease;
}
.adm-side__brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  min-height: 78px;
}
.adm-side__brand img { height: 42px; width: auto; }
.adm-side__close {
  display: none;
  border: 0; background: var(--gray-bg);
  width: 38px; height: 38px; border-radius: 12px;
  font-size: 1.1rem; color: var(--text); cursor: pointer;
}
.adm-nav { padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; }
.adm-nav__label {
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600; color: var(--orange); padding: 8px 14px 4px;
}
.adm-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500; font-size: 0.95rem;
  border: 1px solid transparent;
  transition: var(--transition);
}
.adm-nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.adm-nav a:hover { background: rgba(255, 140, 0, 0.1); color: var(--orange); border-color: rgba(255, 140, 0, 0.25); }
.adm-nav a.is-active { background: var(--blue); color: var(--white); box-shadow: var(--shadow); }
.adm-nav a.is-active:hover { background: var(--blue-dark); color: var(--white); }
.adm-nav__logout { margin-top: auto; color: #c0392b !important; }
.adm-nav__logout:hover { background: rgba(192, 57, 43, 0.08); border-color: rgba(192, 57, 43, 0.25); color: #c0392b !important; }

.adm-scrim {
  position: fixed; inset: 0;
  background: rgba(10, 22, 40, 0.5);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 55;
}
.adm-scrim.is-open { opacity: 1; visibility: visible; }

/* Main + topbar ------------------------------------------------------------ */
.adm-main { flex: 1; min-width: 0; margin-left: 264px; display: flex; flex-direction: column; }

.adm-top {
  position: sticky; top: 0; z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  min-height: 78px;
}
.adm-burger {
  display: none;
  width: 44px; height: 44px; flex: 0 0 44px;
  border: 0; border-radius: 12px; background: var(--gray-bg); cursor: pointer;
}
.adm-burger span { display: block; width: 20px; height: 2px; margin: 4px auto; background: var(--text); border-radius: 2px; }
.adm-top__title { font-size: 1.15rem; font-weight: 700; color: #16202e; }
.adm-top__sub { font-size: 0.82rem; color: var(--muted); }
.adm-top__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.adm-user { display: flex; align-items: center; gap: 10px; }
.adm-user__avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--blue); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.adm-user__name { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
.adm-user__role { font-size: 0.76rem; color: var(--muted); }

.adm-body { padding: 32px 28px 56px; }
.adm-view { display: none; }
.adm-view.is-active { display: block; }

/* Cards -------------------------------------------------------------------- */
.adm-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.adm-card__head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.adm-card__head h3 { font-size: 1.05rem; }
.adm-card__head .adm-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.adm-card__body { padding: 24px; }

.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.adm-stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  transition: var(--transition);
}
.adm-stat:hover { transform: translateY(-3px); border-left-color: var(--orange); box-shadow: var(--shadow-lg); }
.adm-stat__num { font-size: 2rem; font-weight: 700; color: var(--blue); line-height: 1.2; }
.adm-stat p { font-size: 0.88rem; margin-top: 4px; }

/* Toolbar ------------------------------------------------------------------ */
.adm-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--gray-bg);
}
.adm-input, .adm-select, .adm-textarea {
  font-family: inherit; font-size: 0.92rem; color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  width: 100%;
  transition: var(--transition);
}
.adm-input:focus, .adm-select:focus, .adm-textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(15, 82, 186, 0.1);
}
.adm-textarea { min-height: 108px; resize: vertical; line-height: 1.6; }
.adm-toolbar__search { flex: 1 1 260px; max-width: 380px; }
.adm-toolbar__filter { flex: 0 0 190px; }
.adm-toolbar .adm-count { margin-left: auto; font-size: 0.85rem; color: var(--muted); }

/* Buttons (admin sizes, reuse site look) ----------------------------------- */
.btn--sm { padding: 10px 20px; font-size: 0.86rem; }
.btn--accent { background: var(--orange); color: var(--white); }
.btn--accent:hover { background: var(--blue); color: var(--white); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn--muted { background: var(--gray-bg); color: var(--text); border-color: var(--border); }
.btn--muted:hover { background: var(--border); }
.btn--danger { background: #c0392b; color: var(--white); }
.btn--danger:hover { background: #a5301f; transform: translateY(-2px); }

/* Table -------------------------------------------------------------------- */
.adm-table-wrap { width: 100%; overflow-x: auto; max-height: 62vh; overflow-y: auto; }
.adm-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.adm-table th, .adm-table td { padding: 16px 20px; text-align: left; font-size: 0.9rem; vertical-align: middle; }
.adm-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--white);
  border-bottom: 2px solid var(--blue);
  font-weight: 600; color: #16202e;
  white-space: nowrap;
}
.adm-table thead th.is-sortable { cursor: pointer; user-select: none; transition: var(--transition); }
.adm-table thead th.is-sortable:hover { color: var(--orange); }
.adm-table thead th .caret { opacity: 0.35; margin-left: 6px; font-size: 0.7rem; }
.adm-table thead th.is-sorted .caret { opacity: 1; color: var(--orange); }
.adm-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.adm-table tbody tr:hover { background: rgba(255, 140, 0, 0.07); }
.adm-table td.job-title { font-weight: 600; color: #16202e; }
.adm-table td p { font-size: 0.8rem; }

.badge {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge--published { background: rgba(15, 82, 186, 0.12); color: var(--blue); }
.badge--draft { background: rgba(95, 107, 122, 0.14); color: var(--muted); }
.badge--closed { background: rgba(192, 57, 43, 0.12); color: #c0392b; }
.badge--archived { background: rgba(255, 140, 0, 0.15); color: #b35f00; }

.row-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--white);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--orange); color: var(--orange); transform: translateY(-2px); }
.icon-btn--danger:hover { border-color: #c0392b; color: #c0392b; }

.adm-empty, .adm-loading { padding: 64px 24px; text-align: center; }
.adm-empty h4 { font-size: 1.05rem; margin-bottom: 8px; }
.adm-empty__icon { font-size: 2.4rem; margin-bottom: 10px; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%;
  animation: admSpin 0.9s linear infinite;
}
@keyframes admSpin { to { transform: rotate(360deg); } }

.adm-pagination {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 18px 24px; border-top: 1px solid var(--border);
}
.adm-pagination .page-info { font-size: 0.85rem; color: var(--muted); }
.adm-pagination .pages { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--white); color: var(--text);
  font-family: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
.page-btn.is-active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Drawer ------------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 18, 34, 0.55);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 80;
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 450px; max-width: 100%;
  background: var(--white);
  box-shadow: -18px 0 45px rgba(15, 82, 186, 0.18);
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 90;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 24px; border-bottom: 1px solid var(--border);
}
.drawer__head h3 { font-size: 1.05rem; }
.drawer__head p { font-size: 0.8rem; }
.drawer__close {
  margin-left: auto;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--white);
  font-size: 1.1rem; color: var(--muted); cursor: pointer; transition: var(--transition);
}
.drawer__close:hover { border-color: var(--orange); color: var(--orange); }
.drawer__body { padding: 24px; overflow-y: auto; flex: 1; }
.drawer__foot {
  display: flex; gap: 12px; justify-content: flex-end;
  padding: 18px 24px; border-top: 1px solid var(--border); background: var(--gray-bg);
}

.adm-field { margin-bottom: 18px; }
.adm-field label { display: block; font-size: 0.84rem; font-weight: 600; color: #16202e; margin-bottom: 7px; }
.adm-field .req { color: var(--orange); }
.adm-field .err { display: none; font-size: 0.78rem; color: #c0392b; margin-top: 6px; }
.adm-field.has-error .adm-input,
.adm-field.has-error .adm-select,
.adm-field.has-error .adm-textarea { border-color: #c0392b; box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.08); }
.adm-field.has-error .err { display: block; }
.adm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.adm-readonly dt { font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.adm-readonly dd { margin: 6px 0 20px; color: var(--text); font-size: 0.94rem; white-space: pre-line; }

/* Modal -------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 18, 34, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 440px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  text-align: center;
  transform: translateY(18px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__icon {
  width: 62px; height: 62px; margin: 0 auto 16px;
  border-radius: 50%; background: rgba(192, 57, 43, 0.1); color: #c0392b;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.modal h3 { margin-bottom: 8px; }
.modal__actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* Toast -------------------------------------------------------------------- */
.adm-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  background: var(--blue); color: var(--white);
  padding: 14px 22px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 500;
  display: none;
}

/* Placeholder views -------------------------------------------------------- */
.adm-placeholder { text-align: center; padding: 70px 24px; }
.adm-placeholder .adm-empty__icon { font-size: 2.6rem; }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1100px) {
  .adm-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .adm-side { transform: translateX(-100%); }
  .adm-side.is-open { transform: translateX(0); }
  .adm-side__close { display: block; }
  .adm-main { margin-left: 0; }
  .adm-burger { display: block; }
  .adm-top { padding: 12px 18px; min-height: 70px; }
  .adm-body { padding: 24px 18px 48px; }
  .drawer { width: 80%; }
  .adm-user__name, .adm-user__role { display: none; }
}
@media (max-width: 640px) {
  .adm-stats { grid-template-columns: 1fr; }
  .drawer { width: 100%; border-radius: 0; }
  .adm-grid-2 { grid-template-columns: 1fr; }
  .adm-toolbar { padding: 16px; }
  .adm-toolbar__search, .adm-toolbar__filter { flex: 1 1 100%; max-width: none; }
  .adm-toolbar .adm-count { margin-left: 0; }
  .adm-card__head { padding: 18px 16px; }
  .adm-card__head .adm-actions { margin-left: 0; width: 100%; }
  .adm-card__head .adm-actions .btn { width: 100%; text-align: center; }
  .adm-pagination { padding: 16px; }
  .adm-pagination .pages { margin-left: 0; }
  .adm-toast { left: 16px; right: 16px; text-align: center; }
}
