/* ── Admin Konsole styles ─────────────────────────────────────────────────── */

/* Backdrop overlay */
.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  animation: admFadeIn 0.2s ease both;
}

.admin-backdrop.adm-closing {
  animation: admFadeOut 0.2s ease both;
}

@keyframes admFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes admFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Modal container */
.admin-modal {
  background: var(--sidebar-bg, #fff);
  border-radius: 16px;
  box-shadow:
    0 32px 96px rgba(0, 0, 0, 0.30),
    0 6px 20px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 1200px;
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: admScaleIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.admin-backdrop.adm-closing .admin-modal {
  animation: admScaleOut 0.18s ease both;
}

@keyframes admScaleIn  { from { opacity: 0; transform: scale(0.95) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes admScaleOut { from { opacity: 1; transform: scale(1);                     } to { opacity: 0; transform: scale(0.96); } }

/* Modal header (sticky) */
.admin-modal .adm-header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}

/* Close button */
.adm-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #888);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.adm-close-btn:hover {
  background: var(--hover-bg, rgba(0,0,0,0.07));
  color: var(--text, #111);
}

/* Modal body scrolls */
.admin-modal .adm-body {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

/* Mobile */
@media (max-width: 680px) {
  .admin-backdrop { padding: 14px; }
  .admin-modal    { max-height: calc(100vh - 28px); border-radius: 12px; }
}

/* Dark mode for modal */
body.dark .admin-modal {
  box-shadow:
    0 32px 96px rgba(0, 0, 0, 0.55),
    0 6px 20px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}
body.dark .admin-modal .adm-body {
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

/* ── Standalone page root ────────────────────────────────────────────────── */
#adminRoot {
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg, #f5f5f5);
  color: var(--text, #111);
}

/* Header */
.adm-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border, #e0e0e0);
  background: var(--sidebar-bg, #fff);
  position: sticky;
  top: 0;
  z-index: 10;
}

.adm-back {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted, #666);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.adm-back:hover { background: var(--hover-bg, #f0f0f0); }

.adm-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
}

.adm-refresh-info {
  font-size: 0.75rem;
  color: var(--text-muted, #999);
}

/* Body */
.adm-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Summary cards */
.adm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
}

.adm-card {
  background: var(--sidebar-bg, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.adm-card-accent {
  border-color: #BD9B08;
  background: linear-gradient(135deg, rgba(189,155,8,0.06), transparent);
}

.adm-card-icon { font-size: 1.3rem; margin-bottom: 0.2rem; }

.adm-card-val {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text, #111);
  line-height: 1.1;
}

.adm-card-label {
  font-size: 0.78rem;
  color: var(--text-muted, #777);
  margin-top: 0.1rem;
}

.adm-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted, #999);
  margin-top: 0.3rem;
}

/* Charts */
.adm-charts {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0.9rem;
}

@media (max-width: 800px) {
  .adm-charts { grid-template-columns: 1fr; }
}

.adm-chart-card {
  background: var(--sidebar-bg, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
}

.adm-doughnut-wrap {
  max-width: 180px;
  margin: 0.7rem auto 0.5rem;
}

.adm-mode-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text, #333);
  margin-top: 0.6rem;
}

.adm-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* Section cards (table, status) */
.adm-section-card {
  background: var(--sidebar-bg, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
}

.adm-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #888);
  margin-bottom: 0.9rem;
}

/* Table */
.adm-table-wrap { overflow-x: auto; }

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

.adm-table th {
  text-align: left;
  padding: 0.5rem 0.8rem;
  font-weight: 500;
  color: var(--text-muted, #777);
  border-bottom: 1px solid var(--border, #eee);
  white-space: nowrap;
}

.adm-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border, #f0f0f0);
  color: var(--text, #222);
}

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

.adm-table tbody tr:hover td { background: var(--hover-bg, rgba(0,0,0,0.02)); }

.adm-table th.num,
.adm-table td.num { text-align: right; }

.adm-email { font-size: 0.84rem; }
.adm-date  { font-size: 0.8rem; color: var(--text-muted, #888); white-space: nowrap; }

.adm-empty {
  text-align: center;
  color: var(--text-muted, #aaa);
  padding: 1.5rem !important;
  font-size: 0.85rem;
}

/* System status */
.adm-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.adm-status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.83rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.adm-status-item.ok  { background: rgba(92,184,92,0.12);  border-color: rgba(92,184,92,0.3);  color: #2d7a2d; }
.adm-status-item.err { background: rgba(220,53,69,0.10);  border-color: rgba(220,53,69,0.3);  color: #a01020; }

.adm-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.adm-status-item.ok  .adm-status-dot { background: #5CB85C; }
.adm-status-item.err .adm-status-dot { background: #dc3545; }

/* Admin icon button in sidebar */
.admin-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted, #888);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.admin-icon-btn:hover {
  background: var(--hover-bg, rgba(0,0,0,0.07));
  color: var(--text, #333);
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.adm-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border, #e8e8e8);
  background: var(--sidebar-bg, #fff);
  flex-shrink: 0;
}

.adm-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted, #888);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  margin-bottom: -1px;
}

.adm-tab:hover { color: var(--text, #222); }

.adm-tab.active {
  color: #BD9B08;
  border-bottom-color: #BD9B08;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.adm-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.adm-badge-superadmin { background: rgba(189,155,8,0.15); color: #9a7b00; border: 1px solid rgba(189,155,8,0.35); }
.adm-badge-admin      { background: rgba(74,144,217,0.12); color: #2a6bb5; border: 1px solid rgba(74,144,217,0.30); }
.adm-badge-user       { background: rgba(0,0,0,0.05);      color: #555;    border: 1px solid rgba(0,0,0,0.10); }
.adm-badge-active     { background: rgba(92,184,92,0.12);  color: #2d7a2d; border: 1px solid rgba(92,184,92,0.30); }
.adm-badge-blocked    { background: rgba(220,53,69,0.10);  color: #a01020; border: 1px solid rgba(220,53,69,0.25); }

body.dark .adm-badge-superadmin { color: #e0c040; }
body.dark .adm-badge-admin      { color: #7ab5f0; }
body.dark .adm-badge-user       { color: #aaa; border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); }
body.dark .adm-badge-active     { color: #7de07d; }
body.dark .adm-badge-blocked    { color: #ff7b7b; }

/* ── User management table extras ───────────────────────────────────────── */
.adm-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.adm-search-input {
  padding: 6px 12px;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  font-size: 0.83rem;
  background: var(--bg-secondary, #f9f9f9);
  color: var(--text, #222);
  outline: none;
  width: 200px;
  transition: border-color 0.15s;
}
.adm-search-input:focus { border-color: #BD9B08; }

.adm-user-cell { display: flex; flex-direction: column; gap: 2px; }
.adm-user-name  { font-weight: 500; font-size: 0.85rem; color: var(--text, #222); }
.adm-user-email { font-size: 0.75rem; color: var(--text-muted, #888); }

.adm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.adm-role-select {
  padding: 4px 8px;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--sidebar-bg, #fff);
  color: var(--text, #222);
  cursor: pointer;
}

.adm-block-btn {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s;
}

.adm-block-btn.block {
  background: rgba(220,53,69,0.08);
  color: #c0001a;
  border-color: rgba(220,53,69,0.25);
}
.adm-block-btn.block:hover { background: rgba(220,53,69,0.16); }

.adm-block-btn.unblock {
  background: rgba(92,184,92,0.10);
  color: #1a7a1a;
  border-color: rgba(92,184,92,0.30);
}
.adm-block-btn.unblock:hover { background: rgba(92,184,92,0.20); }

.adm-protected { color: var(--text-muted, #bbb); font-size: 0.85rem; }

body.dark .adm-tabs { background: var(--sidebar-bg, #1a1a1a); }
body.dark .adm-search-input { background: rgba(255,255,255,0.05); color: #ddd; border-color: #333; }
body.dark .adm-role-select  { background: rgba(255,255,255,0.06); color: #ddd; border-color: #333; }
body.dark .adm-block-btn.block   { color: #ff7b7b; }
body.dark .adm-block-btn.unblock { color: #7de07d; }

/* ── Dark mode overrides */
body.dark #adminRoot    { --bg: #0f0f0f; --text: #e8e8e8; --text-muted: #888; --border: #2a2a2a; --sidebar-bg: #181818; --hover-bg: rgba(255,255,255,0.04); }
body.dark .adm-status-item.ok  { color: #7de07d; }
body.dark .adm-status-item.err { color: #ff7b7b; }
body.dark .adm-back:hover       { background: rgba(255,255,255,0.06); }
