/* ============================================
   NichaHub — Admin Panel Styles
   Extends main style.css dark theme variables
   ============================================ */

/* --- Hide page until admin check passes --- */
body {
  visibility: hidden;
}
body.admin-ready {
  visibility: visible;
}

/* --- Variables (mirrors style.css) --- */
:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-surface: #16161f;
  --border: #1e1e2e;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --radius: 12px;
  --radius-sm: 8px;
}

/* =====================
   1. Admin Layout
   ===================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.admin-sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-sidebar-logo {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  color: var(--text);
  background: var(--bg-surface);
}

.admin-sidebar a.active {
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.admin-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

/* =====================
   2. Stat Cards Grid
   ===================== */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-stat-card .stat-label,
.admin-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-stat-card .stat-value,
.admin-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.admin-stat-card .stat-change,
.admin-stat-change {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.admin-stat-card .stat-change.up {
  color: var(--green);
}

.admin-stat-card .stat-change.down {
  color: var(--red);
}

.admin-stat-card .stat-change.neutral {
  color: var(--text-muted);
}

/* Section header (title + action button on one line) */
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-section-header .section-title {
  margin-bottom: 0;
}

/* Filter bar (horizontal row of filter inputs) */
.admin-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.admin-filter-bar .form-group {
  margin-bottom: 0;
}

/* Page header with action button */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.admin-page-header .section-title {
  margin-bottom: 0;
}

/* =====================
   3. Admin Tables
   ===================== */
.admin-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead {
  background: var(--bg-surface);
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background 0.15s;
}

.admin-table tbody tr:hover {
  background: var(--bg-surface);
}

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

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot.active   { background: var(--green); }
.status-dot.inactive { background: var(--text-dim); }
.status-dot.pending  { background: var(--yellow); }
.status-dot.error    { background: var(--red); }

/* =====================
   4. Admin Form
   ===================== */
.admin-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

/* Section titles */
.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  padding-bottom: 10px;
  margin-bottom: 20px;
  margin-top: 28px;
  border-bottom: 1px solid var(--border);
}

.form-section-title:first-child,
.admin-form > .form-section-title:first-child {
  margin-top: 0;
}

/* Form rows */
.form-row {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.form-grid-2,
.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.form-grid-3,
.form-row-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

/* Labels */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Inputs */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

/* Date picker: dark icon + dark popup in all browsers */
.form-input[type="date"],
.form-input[type="datetime-local"],
.form-input[type="time"] {
  color-scheme: dark;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-dim);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Hint text */
.form-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Form actions */
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}

.form-actions-right {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

/* =====================
   5. Filter Constructor
   ===================== */
.form-filter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.form-filter-item .filter-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 120px;
  flex-shrink: 0;
}

.form-filter-item .filter-input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.form-filter-item .filter-input:focus {
  border-color: var(--accent);
}

.form-filter-item .filter-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s;
}

.form-filter-item .filter-remove:hover {
  color: var(--red);
}

/* =====================
   6. Competitor Items
   ===================== */
.form-competitor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.form-competitor .competitor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.form-competitor .competitor-info {
  flex: 1;
  min-width: 0;
}

.form-competitor .competitor-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-competitor .competitor-subs {
  font-size: 12px;
  color: var(--text-muted);
}

.form-competitor .competitor-parsed {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.form-competitor .competitor-parsed.parsed {
  color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}

.form-competitor .competitor-parsed.not-parsed {
  color: var(--text-dim);
  background: rgba(82, 82, 91, 0.15);
}

.form-competitor .competitor-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.form-competitor .competitor-remove:hover {
  color: var(--red);
}

/* =====================
   7. URL Input Row
   ===================== */
.form-add-url {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.form-add-url .form-input {
  flex: 1;
}

.form-add-url .admin-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* =====================
   8. Admin Buttons
   ===================== */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  outline: none;
  text-decoration: none;
  line-height: 1.4;
}

.admin-btn:hover {
  background: var(--bg-card);
  border-color: var(--text-dim);
}

.admin-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.admin-btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}

.admin-btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.admin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* =====================
   9. Category Tree
   ===================== */
.category-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.category-item:hover {
  background: var(--bg-card);
}

/* Indent levels */
.category-item[data-level="1"] { padding-left: 34px; }
.category-item[data-level="2"] { padding-left: 54px; }
.category-item[data-level="3"] { padding-left: 74px; }

.category-item .drag-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 16px;
  flex-shrink: 0;
  user-select: none;
  display: flex;
  align-items: center;
}

.category-item .drag-handle:active {
  cursor: grabbing;
}

.category-item .category-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item .category-count {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.category-item .visibility-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.category-item .visibility-toggle:hover {
  color: var(--text);
}

.category-item .visibility-toggle.hidden {
  color: var(--text-dim);
  opacity: 0.5;
}

/* =====================
   10. Badges
   ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-warning {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
  border-color: rgba(234, 179, 8, 0.25);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-info {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
  border-color: rgba(99, 102, 241, 0.25);
}

.badge-type {
  background: rgba(6, 182, 212, 0.12);
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.25);
}

/* =====================
   11. Alerts
   ===================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* =====================
   12. Admin Cards (list items)
   ===================== */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.admin-card:hover {
  border-color: var(--text-dim);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.admin-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.admin-card-title strong {
  font-weight: 600;
}

.admin-card-title .text-dim {
  font-weight: 400;
  font-size: 13px;
}

.admin-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.admin-card-body {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* =====================
   13. Category Tree (collapsible cards)
   ===================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 900px) {
  .cat-grid { grid-template-columns: 1fr; }
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
  overflow: hidden;
}

.cat-card:hover {
  border-color: var(--text-dim);
}

.cat-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: grab;
}

.cat-chevron {
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.2s;
  user-select: none;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.cat-chevron.open {
  transform: rotate(90deg);
}

.cat-card-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cat-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Children container */
.cat-children {
  padding: 0 16px 10px 40px;
}

.cat-child-row {
  margin-bottom: 4px;
}

.cat-child-main {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.15s;
}

.cat-child-main:hover {
  border-color: var(--text-dim);
}

.cat-child-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.cat-child-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-child-row .cat-children {
  padding-left: 24px;
  padding-bottom: 0;
}

/* =====================
   14. Dynamic Filters (niche edit form)
   ===================== */

/* Alias for Bootstrap-like .form-control */
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control::placeholder {
  color: var(--text-dim);
}

/* Range: two inputs side by side */
.range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Custom checkbox label */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  user-select: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.checkbox-label:hover {
  border-color: var(--accent);
}

/* Hide native checkbox, show custom one */
.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.checkbox-label:hover input[type="checkbox"]:not(:checked) {
  border-color: var(--accent);
}

/* form-checkbox: used in category/filter forms for visible toggle */
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Filters section — add spacing between filter groups */
#dynamic-filters .form-group {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

/* =====================
   15. Empty States
   ===================== */
.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.admin-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--text-dim);
  opacity: 0.5;
}

.admin-empty .empty-text {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}

.admin-empty .empty-action {
  margin-top: 20px;
}

/* =====================
   Responsive (768px)
   ===================== */
@media (max-width: 768px) {
  /* Layout */
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 0;
  }

  .admin-sidebar-logo {
    display: none;
  }

  .admin-sidebar a {
    padding: 12px 16px;
    white-space: nowrap;
    font-size: 13px;
  }

  .admin-sidebar a.active {
    border-left: none;
    border-bottom: 2px solid var(--accent);
    padding-left: 16px;
  }

  .admin-content {
    padding: 20px 16px;
  }

  .admin-page-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  /* Stat cards */
  .admin-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .admin-stat-card {
    padding: 14px;
  }

  .admin-stat-card .stat-value {
    font-size: 22px;
  }

  /* Tables */
  .admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    min-width: 600px;
  }

  /* Forms */
  .admin-form {
    padding: 18px;
  }

  .form-row-grid,
  .form-row-grid-3 {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  /* Competitors */
  .form-competitor {
    flex-wrap: wrap;
  }

  /* URL input */
  .form-add-url {
    flex-direction: column;
  }

  /* Filter items */
  .form-filter-item {
    flex-wrap: wrap;
  }

  .form-filter-item .filter-name {
    min-width: unset;
    width: 100%;
  }

  .form-filter-item .filter-input {
    width: 100%;
  }
}

/* =====================
   16. Admin Competitors (edit page)
   ===================== */
.admin-competitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
}

.admin-comp {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.admin-comp:hover {
  border-color: var(--text-dim);
}

.admin-comp-ava {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

.admin-comp-ava-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, #1e1e3f, #2d2d50);
}

.admin-comp-info {
  flex: 1;
  min-width: 0;
}

.admin-comp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: block;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

a.admin-comp-name:hover {
  color: var(--accent-hover);
}

.admin-comp-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-comp-delete {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.admin-comp-delete:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

/* =====================
   17. Pagination
   ===================== */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  outline: none;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--text-dim);
  color: var(--text);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-ellipsis {
  color: var(--text-dim);
  font-size: 13px;
  padding: 0 4px;
}

.pagination-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pagination-select {
  width: auto;
  min-width: 60px;
  padding: 6px 10px;
  font-size: 13px;
}

@media (max-width: 768px) {
  .admin-pagination {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }

  .pagination-info {
    order: 3;
    width: 100%;
    text-align: center;
  }
}

/* =====================
   18. Searchable Select
   ===================== */
.ss-wrapper {
  position: relative;
  width: 100%;
}

.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
  outline: none;
  box-sizing: border-box;
  min-height: 42px;
}

.ss-trigger:hover,
.ss-trigger:focus {
  border-color: var(--accent);
}

.ss-open .ss-trigger {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.ss-trigger.ss-placeholder .ss-trigger-text {
  color: var(--text-dim);
}

.ss-trigger-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-arrow {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ss-open .ss-arrow {
  transform: rotate(180deg);
}

.ss-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.ss-open .ss-dropdown {
  display: block;
}

.ss-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.ss-search::placeholder {
  color: var(--text-dim);
}

/* --- Toolbar (expand/collapse all) --- */
.ss-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.ss-toolbar-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.ss-toolbar-btn:hover {
  color: var(--text);
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--border);
}

.ss-list {
  max-height: 380px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 4px;
}

/* --- Options (flat & tree) --- */
.ss-option {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-option:hover,
.ss-option.ss-highlighted {
  background: rgba(99, 102, 241, 0.12);
}

.ss-option.ss-active {
  background: var(--accent);
  color: #fff;
}

.ss-option.ss-active.ss-highlighted {
  background: var(--accent-hover);
}

.ss-option-empty {
  color: var(--text-dim);
  font-style: italic;
}

.ss-no-results {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* --- Tree: group headers --- */
.ss-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}

.ss-group-header:hover,
.ss-group-header.ss-highlighted {
  background: rgba(99, 102, 241, 0.12);
}

.ss-group-header.ss-active {
  background: var(--accent);
  color: #fff;
}

.ss-group-chevron {
  font-size: 11px;
  color: var(--text-dim);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.15s;
}

.ss-group-header:hover .ss-group-chevron {
  color: var(--text-muted);
}

.ss-group-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-group-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.ss-group-header.ss-active .ss-group-count {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
}

.ss-group-header.ss-active .ss-group-chevron {
  color: rgba(255,255,255,0.7);
}

/* --- Tree: child items --- */
.ss-option-child {
  padding-left: 44px;
  font-size: 13px;
  border-left: 2px solid rgba(99,102,241,0.2);
  margin-left: 20px;
}

.ss-option-sub {
  padding-left: 44px;
  font-size: 12px;
  border-left: 2px solid rgba(99,102,241,0.12);
  margin-left: 40px;
}

/* --- Tree: item icons --- */
.ss-item-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* --- Search: breadcrumb path --- */
.ss-breadcrumb {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.ss-option.ss-active .ss-breadcrumb {
  color: rgba(255,255,255,0.6);
}

/* Choice rows drag & drop */
.choice-row.dragging {
  opacity: 0.4;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
}

.choice-drag:hover {
  color: var(--text-muted) !important;
}
