/* NewsPulse admin: dashboard look (dark sidebar, metric cards) */

/* --- Sidebar: navy --- */
@media (min-width: 768px) {
  html[data-theme="auto"] #nav-sidebar,
  html:not([data-theme]) #nav-sidebar,
  html[data-theme="light"] #nav-sidebar {
    background: linear-gradient(180deg, #1a2744 0%, #0f172a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  #nav-sidebar .toggle-nav-sidebar {
    border-right-color: rgba(255, 255, 255, 0.08);
    background: #1e293b;
    color: #e2e8f0;
  }

  #nav-sidebar .current-app .section:link,
  #nav-sidebar .current-model,
  #nav-sidebar a:focus,
  #nav-sidebar a:hover,
  #nav-sidebar a:link,
  #nav-sidebar a:visited {
    color: #cbd5e1;
  }

  #nav-sidebar .current-app .section:link,
  #nav-sidebar .current-model {
    color: #f8fafc;
    font-weight: 600;
  }

  #nav-sidebar caption {
    background: transparent;
  }

  #nav-sidebar th,
  #nav-sidebar td {
    border-color: rgba(255, 255, 255, 0.06);
  }
}

/* Main area background */
.np-dashboard .main {
  background: #f1f5f9;
}

.np-dashboard #content {
  background: transparent;
}

.np-dashboard .np-dashboard-main {
  max-width: 1200px;
}

/* Header row */
.np-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.np-page-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.np-bc-right {
  font-size: 0.8125rem;
  color: #64748b;
}

.np-bc-right a {
  color: #3b82f6;
  text-decoration: none;
}

.np-bc-right a:hover {
  text-decoration: underline;
}

.np-bc-sep {
  margin: 0 0.35rem;
  color: #94a3b8;
}

/* Metric cards */
.np-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.np-metric-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.np-metric-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.np-mc-1 .np-metric-icon {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.np-mc-2 .np-metric-icon {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
}

.np-mc-3 .np-metric-icon {
  background: linear-gradient(135deg, #22c55e, #14b8a6);
}

.np-mc-4 .np-metric-icon {
  background: linear-gradient(135deg, #f97316, #eab308);
}

.np-metric-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.np-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}

.np-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.np-metric-trend {
  font-size: 0.75rem;
  color: #475569;
}

.np-muted {
  color: #94a3b8;
}

.np-up {
  color: #16a34a;
}

.np-down {
  color: #dc2626;
}

/* Two columns */
.np-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .np-two-col {
    grid-template-columns: 1.2fr 1fr;
    align-items: stretch;
  }
}

.np-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

/* Featured */
.np-featured-visual {
  position: relative;
  min-height: 160px;
  background: linear-gradient(120deg, #1e3a5f 0%, #0f766e 45%, #14532d 100%);
  background-image:
    linear-gradient(120deg, rgba(30, 58, 95, 0.92) 0%, rgba(15, 118, 110, 0.75) 45%, rgba(20, 83, 45, 0.85) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath fill='%23ffffff08' d='M0 80 L40 40 L80 90 L120 30 V120 H0 Z'/%3E%3C/svg%3E");
  background-size: cover, 200px;
}

.np-featured-overlay {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.np-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.np-badge-date {
  background: rgba(255, 255, 255, 0.25);
}

.np-featured-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.8125rem;
  color: #f1f5f9;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
}

.np-featured-text {
  padding: 1rem 1.1rem 1.15rem;
}

.np-featured-text h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

.np-featured-text p {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #475569;
}

.np-featured-actions {
  margin: 0 !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.np-featured-actions .button {
  background: #2563eb;
  color: #fff;
  font-size: 0.8125rem;
  padding: 0.4rem 0.8rem;
}

.np-featured-actions .button:hover {
  background: #1d4ed8;
}

/* Recent list */
.np-recent-title {
  padding: 0.85rem 1rem 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.np-accent-bar {
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: #3b82f6;
}

.np-recent-list {
  list-style: none;
  margin: 0;
  padding: 0 0.35rem 0.5rem;
}

.np-recent-list li {
  border-bottom: 1px solid #f1f5f9;
}

.np-recent-list li:last-child {
  border-bottom: none;
}

.np-recent-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.65rem;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}

.np-recent-link:hover {
  background: #f8fafc;
}

.np-recent-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  flex-shrink: 0;
}

.np-recent-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.np-recent-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-recent-sub {
  font-size: 0.75rem;
  color: #64748b;
}

.np-recent-price {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #16a34a;
  flex-shrink: 0;
}

/* Mini runs */
.np-mini-runs {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.75rem 1rem 0.5rem;
  margin-bottom: 1rem;
}

.np-mini-title {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.np-mini-runs ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.np-mini-runs li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8125rem;
}

.np-mini-runs li:last-child {
  border-bottom: none;
}

.np-mini-runs a {
  font-weight: 600;
  color: #2563eb;
}

.np-run-q {
  color: #64748b;
  flex: 1;
  min-width: 120px;
}

.np-run-st {
  font-weight: 600;
  font-size: 0.75rem;
}

.np-st-success {
  color: #16a34a;
}

.np-st-failed {
  color: #dc2626;
}

.np-st-running {
  color: #ca8a04;
}

/* App list collapse */
.np-app-collapse {
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.np-app-collapse summary {
  cursor: pointer;
  font-weight: 700;
  color: #334155;
  padding: 0.35rem 0.25rem;
}

.np-app-collapse .np-app-list {
  padding-top: 0.5rem;
}

.np-dashboard .np-app-list .module {
  margin-bottom: 0.75rem;
}

.np-dashboard .np-app-list .module table {
  border-radius: 8px;
  overflow: hidden;
}

/* Sidebar recent actions (right column) */
.np-dashboard #content-related .module {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Dark mode: soften */
html[data-theme="dark"] .np-dashboard .main {
  background: var(--body-bg);
}

html[data-theme="dark"] .np-metric-card,
html[data-theme="dark"] .np-card,
html[data-theme="dark"] .np-mini-runs,
html[data-theme="dark"] .np-app-collapse {
  background: var(--darkened-bg);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .np-page-head h1,
html[data-theme="dark"] .np-metric-value,
html[data-theme="dark"] .np-recent-name,
html[data-theme="dark"] .np-featured-text h2 {
  color: var(--body-fg);
}
