:root {
  --bg: #0d0d0d;
  --card: #171717;
  --card-hover: #1c1c1c;
  --border: #262626;
  --accent: #ff2d75;
  --accent-soft: rgba(255, 45, 117, 0.14);
  --text: #f3f3f3;
  --text-dim: #a3a3a3;
  --text-faint: #6b6b6b;
  --sidebar-w: 250px;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); }
a { text-decoration: none; }

.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #111111;
  border-right: 1px solid var(--border);
  padding: 1.4rem 1rem;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}
.admin-sidebar .brand {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.6rem 1.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.admin-sidebar .brand .dot { color: var(--accent); }
.admin-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  transition: all 0.2s ease;
}
.admin-nav a i { width: 18px; text-align: center; }
.admin-nav a:hover { background: var(--card); color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent); }
.admin-nav .section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 1rem 0.8rem 0.4rem;
}

.admin-main { margin-left: var(--sidebar-w); min-height: 100vh; padding-bottom: 3.25rem; }
.admin-topbar {
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.6rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
}
.admin-content { padding: 1.6rem; }

.admin-dev-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 95;
  padding: 0.85rem 1.6rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(8px);
}
.admin-dev-footer span { color: var(--accent); }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.3rem;
  transition: transform 0.25s, border-color 0.25s;
}
.stat-card:hover { transform: translateY(-3px); border-color: #333; }
.stat-card .icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}
.stat-card .value { font-size: 1.6rem; font-weight: 800; }
.stat-card .label { color: var(--text-faint); font-size: 0.82rem; }

.live-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #86efac;
  font-size: 0.82rem;
  font-weight: 700;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.live-stat-card {
  border-color: rgba(34, 197, 94, 0.28);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(23, 23, 23, 1));
}
.live-stat-card .live-icon {
  background: rgba(34, 197, 94, 0.14);
  color: #22c55e;
  margin-bottom: 0;
}
.live-stat-card .live-value {
  color: #86efac;
}
.live-visitor-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.live-visitor-row:last-child { border-bottom: 0; }
.live-device-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.live-device-badge.mobile {
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
}
.live-device-badge.desktop {
  background: rgba(168, 85, 247, 0.14);
  color: #c084fc;
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
}

.table-dark-vh { color: var(--text); }
.table-dark-vh thead th {
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.8rem;
}
.table-dark-vh tbody td { padding: 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.88rem; }
.table-dark-vh tbody tr { transition: background 0.2s; }
.table-dark-vh tbody tr:hover { background: var(--card-hover); }
.table-thumb { width: 90px; height: 54px; object-fit: cover; border-radius: 8px; }

.form-control, .form-select {
  background: #101010;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
}
.form-control:focus, .form-select:focus {
  background: #101010; color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.4rem; }
.form-check-input { background-color: #101010; border-color: var(--border); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

.btn-admin-primary {
  background: var(--accent); border: none; color: #fff; font-weight: 700;
  border-radius: 10px; padding: 0.6rem 1.4rem;
  transition: transform 0.2s;
}
.btn-admin-primary:hover { color: #fff; transform: translateY(-2px); }
.btn-admin-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 10px; padding: 0.6rem 1.2rem; font-weight: 600;
  transition: all 0.2s;
}
.btn-admin-outline:hover { border-color: var(--accent); color: var(--accent); }

.badge-vh { padding: 0.32rem 0.7rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-published { background: rgba(45,212,167,0.14); color: #2dd4a7; }
.badge-draft { background: rgba(163,163,163,0.14); color: #a3a3a3; }
.badge-featured { background: var(--accent-soft); color: var(--accent); }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, rgba(255,45,117,0.08), transparent 45%), var(--bg);
}
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 2.4rem; width: 100%; max-width: 400px;
}

.bulk-dropzone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 2rem 1.2rem;
  text-align: center;
  background: #101010;
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.bulk-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255,45,117,0.06);
}
.bulk-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}
.bulk-thumb-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #101010;
}
.bulk-thumb-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.bulk-thumb-item .num {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.bulk-thumb-item .remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,45,117,0.9);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.cat-icon-select-wrap .cat-icon-preview {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #101010;
}
.cat-icon-preview-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
  flex-shrink: 0;
}
.cat-icon-preview-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

/* Site theme picker (settings) */
.vh-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}
.vh-theme-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #101010;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  min-height: 108px;
}
.vh-theme-card:hover {
  border-color: #444;
  transform: translateY(-2px);
}
.vh-theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.vh-theme-swatches {
  display: flex;
  gap: 4px;
  height: 28px;
}
.vh-theme-swatches span {
  flex: 1;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
}
.vh-theme-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.vh-theme-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.country-clicks-card {
  margin-top: 0;
}
.country-clicks-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.country-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.country-filter-btn {
  border: 1px solid var(--border);
  background: #101010;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.country-filter-btn:hover {
  border-color: #444;
  color: var(--text);
}
.country-filter-btn.active {
  background: var(--accent-soft);
  border-color: rgba(255, 45, 117, 0.45);
  color: var(--accent);
}
.country-sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.country-sort-select {
  min-width: 170px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.country-clicks-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #101010;
}
.country-click-item {
  padding: 1rem 1.1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 118px;
}
.country-click-item:nth-child(4n) {
  border-right: 0;
}
.country-click-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.country-click-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.country-flag,
.country-flag-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #171717;
}
.country-flag-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.country-code {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.country-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.country-click-count {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.country-click-percent {
  margin-top: 0.45rem;
  font-size: 0.74rem;
  color: var(--text-faint);
}
.country-click-bar {
  margin-top: 0.55rem;
  height: 4px;
  border-radius: 999px;
  background: #1f1f1f;
  overflow: hidden;
}
.country-click-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.95), rgba(167, 139, 250, 0.95));
}
.country-clicks-empty {
  grid-column: 1 / -1;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

@media (max-width: 1200px) {
  .country-clicks-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .country-click-item:nth-child(4n) { border-right: 1px solid var(--border); }
  .country-click-item:nth-child(3n) { border-right: 0; }
}
@media (max-width: 992px) {
  .country-clicks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .country-click-item:nth-child(3n) { border-right: 1px solid var(--border); }
  .country-click-item:nth-child(2n) { border-right: 0; }
}
@media (max-width: 576px) {
  .country-clicks-grid { grid-template-columns: 1fr; }
  .country-click-item { border-right: 0 !important; }
  .country-name { max-width: 100%; }
}

@media (max-width: 992px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-dev-footer { left: 0; }
}
