/* -------------------------------------------------------------------------
   7. KPI Cards
   ------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-card-icon svg {
  width: 16px;
  height: 16px;
}
.kpi-card-icon.blue { background: var(--color-primary-soft); color: var(--color-primary); }
.kpi-card-icon.green { background: var(--color-success-soft); color: var(--color-success); }
.kpi-card-icon.amber { background: var(--color-warning-soft); color: var(--color-warning); }
.kpi-card-icon.red { background: var(--color-danger-soft); color: var(--color-danger); }
.kpi-card-icon.purple { background: #F3E8FF; color: var(--color-purple); }
.kpi-card-icon.cyan { background: #ECFEFF; color: var(--color-cyan); }
.kpi-card-delta {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
}
.kpi-card-delta.up { background: var(--color-success-soft); color: var(--color-success); }
.kpi-card-delta.down { background: var(--color-danger-soft); color: var(--color-danger); }
.kpi-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.kpi-card-helper {
  font-size: 12px;
  color: var(--color-text-muted);
}
/* -------------------------------------------------------------------------
   8. Cards / Grid
   ------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-soft);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border-soft);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.card-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.card-body {
  padding: 18px;
}
.card-body.flush {
  padding: 0;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.dashboard-grid-wide {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 14px;
  margin-bottom: 24px;
}
/* Section heading */
.section-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-heading svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}
/* -------------------------------------------------------------------------
   13. Buttons / Forms
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: var(--color-neutral-soft); color: var(--color-text); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); padding: 6px 10px; }
.btn-ghost:hover:not(:disabled) { background: var(--color-neutral-soft); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #B91C1C; }
.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
/* Toggle */
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--color-neutral);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-track.on { background: var(--color-success); }
.toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-track.on .toggle-knob { transform: translateX(16px); }
.toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  user-select: none;
}
/* Select */
.form-select {
  appearance: none;
  padding: 6px 32px 6px 10px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border);
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") right 10px center no-repeat;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color var(--transition);
}
.form-select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.filter-segmented {
  display: inline-flex;
  background: var(--color-neutral-soft);
  border-radius: 8px;
  padding: 2px;
}
.filter-segmented button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--color-text-muted);
  background: transparent;
  transition: all var(--transition);
}
.filter-segmented button.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.filter-segmented button:hover:not(.active) {
  color: var(--color-text-secondary);
}
/* -------------------------------------------------------------------------
   14. Toast
   ------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--color-surface);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-dropdown);
  border-left: 4px solid var(--color-neutral);
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 0.3s ease;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.info { border-left-color: var(--color-primary); }
.toast-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info .toast-icon { color: var(--color-primary); }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; color: var(--color-text); font-size: 13px; }
.toast-message { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.toast-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--color-text); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.removing { animation: toast-out 0.25s ease forwards; }
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}
/* -------------------------------------------------------------------------
   15. Loading / Skeleton
   ------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-soft) 25%, #e8ecf1 50%, var(--color-neutral-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-70 { width: 70%; }
.skeleton-text.w-90 { width: 90%; }
.skeleton-number { height: 32px; width: 80px; margin-bottom: 4px; }
.skeleton-chart { height: 200px; width: 100%; }
.skeleton-bar { height: 24px; margin-bottom: 10px; }
/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner.dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--color-primary);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* -------------------------------------------------------------------------
   16. Empty States
   ------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--color-neutral-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.empty-state-icon svg { width: 24px; height: 24px; color: var(--color-neutral); }
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 4px; }
.empty-state-desc { font-size: 12px; color: var(--color-text-muted); max-width: 280px; }
.error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.error-state-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--color-danger-soft); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.error-state-icon svg { width: 24px; height: 24px; color: var(--color-danger); }
.error-state-title { font-size: 14px; font-weight: 600; color: var(--color-danger); margin-bottom: 4px; }
.error-state-desc { font-size: 12px; color: var(--color-text-muted); }

/* Advanced Comments Filter styling */
.comments-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group .form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.card-footer {
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-surface);
}

/* -------------------------------------------------------------------------
   Video Cards
   ------------------------------------------------------------------------- */
.video-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-soft);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(0,0,0,0.1);
}
.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: var(--color-neutral-soft);
  position: relative;
  overflow: hidden;
}
.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}
.video-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.video-status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.video-status-badge.active .dot { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.video-status-badge.inactive .dot { background: var(--color-text-muted); }

.video-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-channel {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.video-metrics {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-bottom: 16px;
  padding-inline: 16px;
}
.video-metric {
  display: flex;
  flex-direction: column;
}
.video-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.video-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}
.video-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-bg);
}
.video-actions button {
  flex: 1;
  justify-content: center;
}
