/* Diez Admin */

:root {
  --bg: #0e0b14;
  --bg-elevated: #17121f;
  --card: #1c1526;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f1fa;
  --text-muted: #a89bb8;
  --accent: #ff5c8a;
  --accent-2: #ff9a5c;
  --success: #3ddc84;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 0.5rem;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-item.is-active {
  background: rgba(255, 92, 138, 0.12);
  color: var(--text);
}

.nav-item__icon {
  width: 1.4rem;
  text-align: center;
}

.sidebar__footer {
  margin-top: auto;
  padding: 0 0.5rem;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.api-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b6472;
}

.api-status__dot.ok {
  background: #6ee7a0;
}

.api-status__dot.down {
  background: var(--accent);
}

/* ---------- Main ---------- */
.main {
  padding: 2rem 2.5rem;
  /* Widened from 960px so the two-column Reports view (reports + audit)
     fits side by side without cramping the Reported Profiles table back to
     its original full-width size. */
  max-width: 1400px;
  width: 100%;
}

.main__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.main__title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.main__subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.main__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.last-refreshed {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--ghost {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn--small {
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
}

.btn--override {
  background: rgba(72, 199, 142, 0.14);
  border: 1px solid #48c78e;
  color: #48c78e;
}

.btn--override:hover {
  background: rgba(72, 199, 142, 0.24);
}

/* ---------- Alert ---------- */
.alert {
  background: rgba(255, 92, 138, 0.12);
  border: 1px solid rgba(255, 92, 138, 0.4);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.stat__value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat__label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Card / table ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card--section {
  margin-top: 1.5rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  padding: 1.1rem 1.25rem 0;
}

.card__subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.3rem 1.25rem 0;
}

/* Reports view: reports table on the left, audit trail on the right. The
   reports table keeps ~2/3 of the width (close to its pre-audit full width)
   while the audit log takes the remaining third. */
.reports-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* Search box above the audit log — filters both the reports and audit
   tables by reporter/reportee name or email as you type. */
.report-search {
  position: relative;
  padding: 0.6rem 1.25rem 0;
}

.report-search__input {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.report-search__input::placeholder {
  color: var(--text-muted);
}

.report-search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 92, 138, 0.2);
}

/* Hide the browser's native clear × (type="search") — the custom clear
   button below is the only one shown. */
.report-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.report-search__clear {
  position: absolute;
  right: 1.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 1px;
  transition: background 0.15s ease, color 0.15s ease;
}

.report-search__clear:hover {
  background: var(--accent);
  color: #fff;
}

/* Action badges in the audit trail. */
.badge--view {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.badge--ban {
  background: rgba(255, 92, 92, 0.14);
  color: #ff5c5c;
}

.badge--dismiss {
  background: rgba(61, 220, 132, 0.14);
  color: var(--success);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.table th.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.badge--active {
  background: rgba(61, 220, 132, 0.14);
  color: var(--success);
}

.badge--open {
  background: rgba(255, 154, 92, 0.14);
  color: #ffc48a;
}

.badge--resolved {
  background: rgba(61, 220, 132, 0.14);
  color: var(--success);
}

.table__row--clickable {
  cursor: pointer;
}

.table__row--clickable:hover td {
  color: var(--text);
}

.btn--danger {
  background: rgba(255, 92, 92, 0.12);
  border: 1px solid #ff5c5c;
  color: #ff5c5c;
}

.btn--danger:hover {
  background: rgba(255, 92, 92, 0.2);
}

/* ---------- Report detail modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal__card {
  position: relative;
  width: 100%;
  max-width: 56rem;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}

.confirm-modal {
  max-width: 26rem;
}

.confirm-modal__title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.confirm-modal__text {
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.report-detail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.report-detail__title {
  font-size: 1.25rem;
  font-weight: 800;
}

.report-detail__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.report-detail__close:hover {
  color: var(--text);
}

.report-detail__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.report-detail__col-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem;
}

.report-detail__name {
  font-size: 1.3rem;
  font-weight: 800;
}

.report-detail__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.rd-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.rd-images__cell {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.rd-images__cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Photos that matches would NOT show (beyond the plan's photo limit) get a
   translucent red wash + label so admins can tell them apart from visible
   ones at a glance. */
.rd-images__cell--hidden img {
  filter: saturate(0.6) brightness(0.9);
}

.rd-images__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.25rem;
  background: rgba(220, 38, 38, 0.35);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.rd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.rd-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.report-detail__explanation {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
  line-height: 1.5;
}

.report-detail__details {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}

.rd-chat {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 26rem;
  overflow-y: auto;
  padding: 0.25rem;
}

.rd-chat__empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem 0;
}

.rd-chat__msg {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
}

.rd-chat__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.rd-chat__who {
  font-weight: 700;
  font-size: 0.8rem;
}

.rd-chat__when {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.rd-chat__body {
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.report-detail__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.report-detail__message {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--success);
}

.report-detail__message--error {
  color: #ff5c5c;
}

@media (max-width: 768px) {
  .report-detail__grid {
    grid-template-columns: 1fr;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Empty / loading / placeholder ---------- */
.empty {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty__title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.empty__text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.placeholder {
  padding: 3rem 2rem;
  text-align: center;
}

.placeholder__title {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.placeholder__text {
  color: var(--text-muted);
}

/* ---------- Login ---------- */
.login {
  display: grid;
  place-items: center;
  min-height: 70vh;
}

.login__card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
}

.login__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.login__title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.login__subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 0.35rem 0 1.5rem;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.login__input {
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login__input::placeholder {
  color: var(--text-muted);
}

.login__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 92, 138, 0.2);
}

.login__submit {
  margin-top: 1.25rem;
  text-align: center;
}

.login__message {
  margin-top: 1rem;
  min-height: 1.5em;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login__message.error {
  color: var(--accent);
}

/* ---------- Admin info ---------- */
.admin-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar__footer {
    display: none;
  }

  .main {
    padding: 1.5rem 1rem;
  }
}
