/* Custom admin panel */

body.admin-body {
  background: #eceeec;
}
.admin {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-side {
  width: 244px;
  flex: 0 0 244px;
  background: #f4f5f3;
  padding: 26px 18px;
  border-right: 1px solid #e2e5e2;
}
.admin-side .admin-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 34px;
}
.admin-side .admin-brand img {
  height: 64px;
}
.admin-nav a {
  display: block;
  padding: 12px 18px;
  border-radius: 10px;
  color: var(--grey-consult);
  font-size: 15px;
  margin-bottom: 6px;
}
.admin-nav a:hover {
  background: #e9ebe8;
}
.admin-nav a.active {
  background: var(--green);
  color: #fff;
}

/* Main */
.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 30px 40px 50px;
}
.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.admin-topbar h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--grey-consult);
}
.admin-user {
  text-align: right;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.admin-user a {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--green);
  text-decoration: underline;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 16px;
}
.admin-section-head h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--grey-consult);
}

.panel-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px 26px 20px;
  box-shadow: var(--shadow-card);
}

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  text-align: left;
  font-size: 13px;
  color: #7a8382;
  font-weight: 600;
  padding: 16px 12px;
}
.admin-table td {
  padding: 16px 12px;
  font-size: 14px;
  color: var(--text);
  border-top: 1px solid #eef0ee;
}
.admin-table td.actions {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: #fff;
}
.badge--pub {
  background: #2f9e63;
}
.badge--wait {
  background: var(--coral);
}
.badge--draft {
  background: #9aa3a1;
}
.badge--flag {
  background: #d84747;
}

.act {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-consult);
  padding: 4px;
  vertical-align: middle;
}
.act svg {
  width: 18px;
  height: 18px;
}
.act--view {
  color: var(--green);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}
.pagination button {
  min-width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  color: #5a6463;
  font-size: 14px;
}
.pagination button.active {
  background: var(--green);
  color: #fff;
}

/* Sidebar count chip (e.g. pending validations) */
.admin-nav .nav-count {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 12px;
  text-align: center;
  vertical-align: middle;
}
.admin-nav a.active .nav-count {
  background: #fff;
  color: var(--green);
}

/* Dashboard stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--green);
}
.stat-card--wait {
  border-left-color: var(--coral);
}
.stat-card--flag {
  border-left-color: #d84747;
}
.stat-card--pub {
  border-left-color: #2f9e63;
}
.stat-num {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 34px;
  color: var(--grey-consult);
  line-height: 1;
}
.stat-label {
  font-size: 14px;
  color: #5a6463;
}

/* Live panel pagination (server-rendered page links) */
.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}
.admin-pagination .page-num {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #5a6463;
  font-size: 14px;
}
.admin-pagination .page-num.is-active {
  background: var(--green);
  color: #fff;
}

/* Small action buttons (validations) */
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-title);
  font-stretch: 90%;
  font-weight: 600;
}
.btn-sm--ok {
  background: #2f9e63;
}
.btn-sm--no {
  background: #d84747;
  margin-left: 8px;
}

/* Confirmation modal */
body.ttv-modal-open {
  overflow: hidden;
}
.ttv-modal[hidden] {
  display: none;
}
.ttv-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ttv-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 28, 0.5);
}
.ttv-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.ttv-modal__title {
  margin: 0 0 10px;
  font-size: 20px;
  color: #2b3a36;
}
.ttv-modal__msg {
  margin: 0 0 22px;
  color: #5a6463;
  line-height: 1.5;
}
.ttv-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.ttv-modal__confirm--danger {
  background: #d84747;
  border-color: #d84747;
}

@media (max-width: 1024px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .admin {
    flex-direction: column;
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .admin-side {
    width: 100%;
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 14px;
  }
  .admin-side .admin-brand {
    margin: 0 10px 0 0;
  }
  .admin-side .admin-brand img {
    height: 40px;
  }
  .admin-nav {
    display: flex;
    gap: 6px;
  }
  .admin-nav a {
    white-space: nowrap;
    margin: 0;
  }
  .admin-main {
    padding: 20px;
    overflow-x: auto;
  }
  .panel-card {
    overflow-x: auto;
  }
}
