/* ============================================================
   KNOWZY DASHBOARD  (Sprint 1)
   New classes only — .kn-dashboard-* prefix.
   Uses tokens from knowzy-v2.css (:root).
   ============================================================ */

.kn-dashboard-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

/* ---- Page title row ---- */
.kn-dashboard-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kn-dashboard-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0d2b4e;
  margin: 0;
}

.kn-dashboard-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--kn-primary);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-decoration: none;
  transition: filter 0.15s ease;
}

.kn-dashboard-new-btn:hover {
  filter: brightness(1.12);
  color: #fff;
}

.kn-dashboard-new-btn-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* ---- Quick search bar (Google-style) ---- */
.kn-dashboard-quicksearch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid var(--kn-border);
  border-radius: 999px;
  box-shadow: var(--kn-shadow);
  padding: 0.45rem 0.5rem 0.45rem 1.15rem;
  margin-bottom: 0;
}

.kn-dashboard-quicksearch-wrap {
  margin-bottom: 1.25rem;
}

.kn-dashboard-quota {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  box-shadow: var(--kn-shadow);
  padding: 0.85rem 1.1rem 1rem;
  margin-bottom: 1rem;
}

.kn-dashboard-quota-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.kn-dashboard-quota-count {
  font-size: 0.92rem;
  font-weight: 650;
  color: #0d2b4e;
}

.kn-dashboard-quota-reset {
  font-size: 0.78rem;
  color: #777;
}

.kn-dashboard-quota-bar {
  height: 8px;
  background: #e8eef4;
  border-radius: 99px;
  overflow: hidden;
}

.kn-dashboard-quota-bar i {
  display: block;
  height: 100%;
  background: #005499;
  border-radius: 99px;
}

.kn-dashboard-quota.is-tight .kn-dashboard-quota-bar i {
  background: #c47b16;
}

.kn-dashboard-quota.is-empty .kn-dashboard-quota-bar i {
  background: #c0392b;
}

.kn-dashboard-quota-error {
  color: #c0392b;
  font-size: 0.82rem;
  margin: 0.45rem 0 0 1.15rem;
}

.kn-dashboard-quicksearch i {
  color: #888;
  font-size: 1rem;
}

.kn-dashboard-quicksearch input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.925rem;
  color: var(--kn-text);
}

.kn-dashboard-quicksearch input::placeholder {
  color: #999;
}

.kn-dashboard-quicksearch button {
  background: var(--kn-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 1.35rem;
  transition: filter 0.15s ease;
}

.kn-dashboard-quicksearch button:hover {
  filter: brightness(1.12);
}

/* ---- Filter bar (Trustpilot-style chips) ---- */
.kn-dashboard-filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.kn-dashboard-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kn-dashboard-chip {
  background: #fff;
  border: 1px solid var(--kn-border);
  border-radius: 999px;
  color: #444;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kn-dashboard-chip:hover {
  border-color: var(--kn-primary);
  color: var(--kn-primary);
}

.kn-dashboard-chip.active {
  background: var(--kn-primary);
  border-color: var(--kn-primary);
  color: #fff;
}

.kn-dashboard-sort {
  background: #fff;
  border: 1px solid var(--kn-border);
  border-radius: 8px;
  color: #444;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

/* ---- Overview stats strip (Trustpilot-style summary) ---- */
.kn-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.kn-dashboard-stat {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  box-shadow: var(--kn-shadow);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kn-dashboard-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0d2b4e;
  line-height: 1.15;
}

.kn-dashboard-stat-value.risk-high {
  color: #c0392b;
}

.kn-dashboard-stat-label {
  font-size: 0.78rem;
  color: #777;
  font-weight: 500;
}

/* ---- Result list ---- */
.kn-dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ---- Entity avatar (initials block) ---- */
.kn-dashboard-avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--kn-primary), #1273c4);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.kn-dashboard-avatar.muted {
  background: #e9edf2;
  color: #5a6b7e;
}

/* Card head: avatar + identity + right meta */
.kn-dashboard-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.kn-dashboard-card-head .kn-dashboard-identity {
  flex: 1;
  min-width: 0;
}

/* ---- Compact rating distribution (Trustpilot mini bars) ---- */
.kn-dashboard-dist-mini {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 300px;
  margin-top: 0.6rem;
}

.kn-dashboard-dist-mini .row-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: #777;
}

.kn-dashboard-dist-mini .lbl {
  width: 34px;
  white-space: nowrap;
}

.kn-dashboard-dist-mini .bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

.kn-dashboard-dist-mini .fill {
  height: 100%;
  background: #f5a623;
  border-radius: 999px;
}

.kn-dashboard-dist-mini .pct {
  width: 30px;
  text-align: right;
}

/* ---- Media strip (images + video count) ---- */
.kn-dashboard-media {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.kn-dashboard-media-thumb {
  width: 72px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e3e3e3;
  background: #f0f2f4;
}

.kn-dashboard-media-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 52px;
  border-radius: 6px;
  border: 1px solid #e3e3e3;
  background: #f8f9fa;
  color: #555;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

.kn-dashboard-media-video {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--kn-primary);
  background: #eaf3fb;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* ---- Layout A — Trustpilot-style card ---- */
.kn-dashboard-card {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  box-shadow: var(--kn-shadow);
  padding: 1.15rem 1.35rem;
}

.kn-dashboard-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.kn-dashboard-entity {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0d2b4e;
  margin: 0;
}

.kn-dashboard-meta {
  font-size: 0.82rem;
  color: #666;
  margin: 0.15rem 0 0;
}

.kn-dashboard-date {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
}

.kn-dashboard-topright {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Rating line */
.kn-dashboard-rating-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #444;
}

.kn-dashboard-rating-value {
  font-weight: 700;
  color: #0d2b4e;
}

.kn-dashboard-rating-sep {
  color: #bbb;
}

/* AI snippet */
.kn-dashboard-snippet {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.55;
  margin: 0.55rem 0 0;
  font-style: italic;
}

/* Card footer / report link */
.kn-dashboard-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.7rem;
}

.kn-dashboard-delete-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.kn-dashboard-delete-btn:hover:not(:disabled) {
  color: #b00020;
  text-decoration: underline;
}

.kn-dashboard-delete-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.kn-dashboard-report-link {
  background: none;
  border: none;
  color: var(--kn-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.kn-dashboard-report-link:hover {
  text-decoration: underline;
}

/* ---- Layout B — Google Search-style row ---- */
.kn-dashboard-row {
  background: #fff;
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  padding: 0.9rem 1.35rem;
}

.kn-dashboard-row .kn-dashboard-entity {
  font-size: 0.98rem;
}

.kn-dashboard-cbl-chip {
  display: inline-block;
  align-self: flex-start;
  margin: 0.4rem 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #a02020;
  background: #fdeaea;
  border: 1px solid #eabcbc;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  white-space: nowrap;
}

.kn-dashboard-row-generating {
  opacity: 0.85;
}

.kn-dashboard-noreviews {
  font-size: 0.82rem;
  color: #777;
  margin: 0.35rem 0 0;
}

/* ---- Risk badge ---- */
.kn-risk-badge {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.7rem;
  white-space: nowrap;
}

.kn-risk-badge.low {
  background: #e6f4ea;
  color: #1e7e34;
}

.kn-risk-badge.medium {
  background: #fff4e0;
  color: #b26a00;
}

.kn-risk-badge.high {
  background: #fdeaea;
  color: #c0392b;
}

.kn-risk-badge.na {
  background: #eef0f3;
  color: #5c6570;
}

/* Temporary: hide risk badge. Markup and scoring stay. */
.kn-risk-badge {
  display: none !important;
}

/* ---- Star rating ---- */
.kn-star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: #f5a623;
  font-size: 0.95rem;
  letter-spacing: 1px;
  line-height: 1;
}

.kn-star-rating .star-empty {
  color: #d8d8d8;
}

/* ---- Empty state ---- */
.kn-dashboard-empty {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  box-shadow: var(--kn-shadow);
  text-align: center;
  padding: 3rem 1.5rem;
}

.kn-dashboard-empty-icon {
  font-size: 2rem;
  color: var(--kn-primary);
  margin-bottom: 0.75rem;
}

.kn-dashboard-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0d2b4e;
  margin: 0 0 0.35rem;
}

.kn-dashboard-empty-sub {
  font-size: 0.88rem;
  color: #666;
  margin: 0 0 1.25rem;
}

/* ---- Toast (report stub) ---- */
.kn-dashboard-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0d2b4e;
  color: #fff;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 0.7rem 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 1080;
}

@media (max-width: 576px) {
  .kn-dashboard-card,
  .kn-dashboard-row {
    padding: 1rem;
  }

  .kn-dashboard-titlebar {
    flex-direction: column;
    align-items: flex-start;
  }

  .kn-dashboard-stats {
    grid-template-columns: 1fr;
  }

  .kn-dashboard-avatar {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
  }
}
