/* /connect/admin/views/dashboard.css — Admin Dashboard v2 ("Vibrant Community")
 *
 * View-local skin for dashboard.js. Scoped under `.adash-view` so it only
 * touches the Dashboard; it layers on top of admin-shell.css / admin-views.css
 * (loads after both) and consumes only --bcc-* tokens from connect-tokens.css.
 *
 * Intentional hard-coded colour: #fff (text on gradient / solid primary).
 * Everything else derives from --bcc-* tokens or rgba(var(--*-rgb), a).
 * ─────────────────────────────────────────────────────────────────── */

/* ================================================================
   PAGE + HEADER
=============================================================== */
.adash-view {
  --adash-tone:       var(--bcc-primary);
  --adash-tone-rgb:   var(--bcc-primary-rgb);
}

.adash-header {
  align-items: flex-end;
  gap:         var(--bcc-s4);
}

.adash-header-copy { min-width: 0; }

.adash-title {
  margin-bottom: var(--bcc-s1);
}

/* Eyebrow-style greeting with a live accent tick */
.adash-greeting {
  display:     flex;
  align-items: center;
  gap:         var(--bcc-s2);
  color:       var(--bcc-ink-2);
  flex-wrap:   wrap;
}

.adash-header-actions {
  display:     flex;
  align-items: center;
  gap:         var(--bcc-s2);
  flex-shrink: 0;
}

.bcc-app .adash-refresh {
  background:   linear-gradient(180deg, var(--bcc-primary), var(--bcc-primary-hover));
  border-color: transparent;
  color:        #fff;
  box-shadow:   0 1px 2px rgba(var(--bcc-primary-rgb), .35),
                inset 0 1px 0 rgba(255, 255, 255, .18);
}

.bcc-app .adash-refresh:hover {
  transform:  translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--bcc-primary-rgb), .42);
}

.adash-btn-ic {
  display:     inline-flex;
  align-items: center;
  width:       1.05em;
  height:      1.05em;
}

.adash-btn-ic .bcc-icon { width: 100%; height: 100%; }

/* ================================================================
   KPI STAT GRID — 10 cards, count-up, skeleton, `--` fallback
=============================================================== */
.adash-block { margin-bottom: var(--bcc-s6); }

.adash-stats {
  margin-bottom: 0;
}

.adash-stats > .adash-stat {
  position:   relative;
  overflow:   hidden;
  gap:        var(--bcc-s2);
  background: linear-gradient(180deg, var(--bcc-surface-1), var(--bcc-surface-2));
}

/* Tone cycle — primary / secondary / accent / info (token-driven) */
.adash-stats > .adash-stat:nth-child(4n+1) { --adash-tone: var(--bcc-primary);   --adash-tone-rgb: var(--bcc-primary-rgb); }
.adash-stats > .adash-stat:nth-child(4n+2) { --adash-tone: var(--bcc-secondary); --adash-tone-rgb: var(--bcc-secondary-rgb); }
.adash-stats > .adash-stat:nth-child(4n+3) { --adash-tone: var(--bcc-accent);    --adash-tone-rgb: var(--bcc-accent-rgb); }
.adash-stats > .adash-stat:nth-child(4n+4) { --adash-tone: var(--bcc-info);      --adash-tone-rgb: var(--bcc-info-rgb); }

/* Top accent rail (overrides the shell's full-spectrum rail) */
.adash-stats .adash-stat::after {
  content:    '';
  position:   absolute;
  inset:      0 0 auto 0;
  height:     3px;
  background: linear-gradient(90deg, var(--adash-tone), rgba(var(--adash-tone-rgb), .25));
  pointer-events: none;
}

.adash-stats .adash-stat:hover {
  border-color: rgba(var(--adash-tone-rgb), .42);
  box-shadow:   var(--bcc-shadow-2), 0 0 0 1px rgba(var(--adash-tone-rgb), .12);
}

.adash-stat-top {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--bcc-s2);
}

.adash-stat-icon {
  margin-bottom: 0;
  background:    rgba(var(--adash-tone-rgb), .14);
  color:         var(--adash-tone);
  box-shadow:    inset 0 0 0 1px rgba(var(--adash-tone-rgb), .18);
  transition:    background var(--bcc-dur-2) var(--bcc-ease),
                 color var(--bcc-dur-2) var(--bcc-ease);
}

.adash-stat-icon .bcc-icon { width: 18px; height: 18px; }

.adash-stats .adash-stat-value {
  font-family:    var(--bcc-font-display);
  font-size:      var(--bcc-t-3xl);
  letter-spacing: -.02em;
  animation:      bcc-count-up var(--bcc-dur-3) var(--bcc-ease);
}

.adash-stat-label { color: var(--bcc-ink-3); }

/* Trend affordance */
.adash-stat-delta {
  display:       inline-flex;
  align-items:   center;
  gap:           3px;
  padding:       2px var(--bcc-s2);
  border-radius: var(--bcc-r-pill);
  font-size:     var(--bcc-t-xs);
  font-weight:   700;
  line-height:   1.3;
  white-space:   nowrap;
}

.adash-stat-delta.is-up   { color: var(--bcc-success); background: var(--bcc-success-soft); }
.adash-stat-delta.is-down { color: var(--bcc-danger);  background: var(--bcc-danger-soft);  }
.adash-stat-delta.is-flat { color: var(--bcc-ink-3);   background: var(--bcc-surface-3);    }

.adash-stat-delta--label {
  background: transparent;
  padding:    2px 0;
  font-weight: 500;
}

.adash-stat-delta-label { color: var(--bcc-ink-3); }

/* Skeleton card */
.adash-stat--skel { pointer-events: none; }
.adash-skel-ic    { width: 36px; height: 36px; border-radius: var(--bcc-r-sm); }
.adash-skel-chip  { width: 44px; height: 18px; border-radius: var(--bcc-r-pill); margin: 0; }
.adash-skel-value { width: 62%; height: 26px; margin: var(--bcc-s2) 0; }

/* ================================================================
   THREE-COLUMN SECTION
=============================================================== */
.adash-col {
  display:        flex;
  flex-direction: column;
  gap:            var(--bcc-s2);
  background:     linear-gradient(180deg, var(--bcc-surface-1), var(--bcc-surface-1));
}

.adash-col-head {
  align-items:   center;
  gap:           var(--bcc-s2);
  padding-bottom: var(--bcc-s2);
  border-bottom: 1px solid var(--bcc-border);
  margin-bottom: var(--bcc-s2);
}

.adash-col-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           28px;
  height:          28px;
  flex-shrink:     0;
  border-radius:   var(--bcc-r-sm);
  background:      var(--bcc-primary-soft);
  color:           var(--bcc-primary);
}

.adash-col-icon .bcc-icon { width: 15px; height: 15px; }

.adash-col-head--ai .adash-col-icon {
  background: rgba(var(--bcc-accent-rgb), .16);
  color:      var(--bcc-accent);
}

.adash-col-title {
  flex:         1;
  min-width:    0;
  font-size:    var(--bcc-t-md);
}

.adash-col-link {
  margin-left: auto;
}

.adash-live { margin-left: auto; }

/* ================================================================
   ACTIVITY FEED — type-coloured icons
=============================================================== */
.adash-activity { gap: 0; }

.adash-activity-item {
  padding: var(--bcc-s3) 0;
}

.adash-activity-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          30px;
  flex-shrink:     0;
  margin-top:      0;
  text-align:      center;
  border-radius:   var(--bcc-r-sm);
  background:      var(--bcc-surface-3);
  color:           var(--bcc-ink-3);
}

.adash-activity-icon .bcc-icon { width: 15px; height: 15px; }

.adash-activity-text { color: var(--bcc-ink-2); }
.adash-activity-text strong { color: var(--bcc-ink); font-weight: 600; }
.adash-activity-text em { color: var(--bcc-ink-2); font-style: normal; }

.adash-activity-loading { color: var(--bcc-ink-3); }

/* Tone variants */
.adash-tone--success   .adash-activity-icon { background: var(--bcc-success-soft); color: var(--bcc-success); }
.adash-tone--danger    .adash-activity-icon { background: var(--bcc-danger-soft);  color: var(--bcc-danger);  }
.adash-tone--accent    .adash-activity-icon { background: rgba(var(--bcc-accent-rgb), .16); color: var(--bcc-accent); }
.adash-tone--primary   .adash-activity-icon { background: var(--bcc-primary-soft); color: var(--bcc-primary); }
.adash-tone--secondary .adash-activity-icon { background: rgba(var(--bcc-secondary-rgb), .16); color: var(--bcc-secondary); }
.adash-tone--neutral   .adash-activity-icon { background: var(--bcc-surface-3);    color: var(--bcc-ink-2);   }

/* ================================================================
   UPCOMING EVENTS
=============================================================== */
.adash-events { display: flex; flex-direction: column; }

.adash-event-item {
  gap:     var(--bcc-s3);
  padding: var(--bcc-s3) 0;
}

.adash-event-date {
  width:         46px;
  background:    linear-gradient(180deg, var(--bcc-primary-soft), rgba(var(--bcc-primary-rgb), .06));
  border:        1px solid rgba(var(--bcc-primary-rgb), .22);
  border-radius: var(--bcc-r-sm);
  padding:       var(--bcc-s1) 0;
}

.adash-event-month { line-height: 1.2; }
.adash-event-day   { font-family: var(--bcc-font-display); }
.adash-event-title { font-weight: 600; }
.adash-events-loading { padding: var(--bcc-s3) 0; }

/* ================================================================
   QUICK ACTIONS — bold tiles
=============================================================== */
.bcc-app .adash-quick {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:                   var(--bcc-s2);
}

.bcc-app .adash-quick-btn {
  min-height: 84px;
  background: linear-gradient(180deg, var(--bcc-surface-2), var(--bcc-surface-3));
  border:     1px solid var(--bcc-border);
  font-weight: 600;
}

.bcc-app .adash-quick-btn:hover {
  border-color: rgba(var(--bcc-primary-rgb), .55);
  box-shadow:   0 6px 18px rgba(var(--bcc-primary-rgb), .16);
}

.bcc-app .adash-quick-btn:active { transform: translateY(0); }

.adash-quick-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           34px;
  height:          34px;
  border-radius:   var(--bcc-r-md);
  background:      var(--bcc-primary-soft);
  color:           var(--bcc-primary);
  line-height:     1;
}

.adash-quick-icon .bcc-icon { width: 18px; height: 18px; }

.adash-quick-btn:hover .adash-quick-icon {
  background: var(--bcc-primary);
  color:      #fff;
}

.adash-quick-label {
  font-size:   var(--bcc-t-xs);
  line-height: 1.25;
}

/* ================================================================
   AI INSIGHTS
=============================================================== */
.adash-ai {
  background:  linear-gradient(180deg, var(--bcc-surface-2), rgba(var(--bcc-accent-rgb), .05));
  border:      1px solid var(--bcc-border);
  color:       var(--bcc-ink-2);
}

.adash-ai-placeholder { margin: 0; }

.adash-ai-cursor {
  display:    inline-block;
  color:      var(--bcc-accent);
  animation:  adm-cursor-blink 1s steps(2, start) infinite;
}

/* ================================================================
   EMPTY + LOADING STATES
=============================================================== */
.adash-empty {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             var(--bcc-s2);
  padding:         var(--bcc-s8) var(--bcc-s4);
  text-align:      center;
}

.adash-empty-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           46px;
  height:          46px;
  border-radius:   var(--bcc-r-pill);
  background:      var(--bcc-surface-3);
  color:           var(--bcc-ink-3);
}

.adash-empty-icon .bcc-icon { width: 22px; height: 22px; }

.adash-empty-title {
  font-family: var(--bcc-font-display);
  font-size:   var(--bcc-t-lg);
  font-weight: 600;
  color:       var(--bcc-ink-2);
}

.adash-empty-sub {
  font-size: var(--bcc-t-xs);
  color:     var(--bcc-ink-3);
  max-width: 240px;
}

/* ================================================================
   RESPONSIVE
   Base grid columns come from admin-shell.css; refine gaps + internals.
=============================================================== */

/* ── ≥1025 desktop: keep 4-up KPIs, 3-up sections ─────────────── */
@media (min-width: 1025px) {
  .adash-header { margin-bottom: var(--bcc-s6); }
}

/* ── 768–1024 tablet ──────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1024px) {
  .adash-col-head { margin-bottom: var(--bcc-s2); }
  .adash-stats    { gap: var(--bcc-s3); }
}

/* ── 481–767 large phone ──────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 767px) {
  .adash-header { align-items: flex-start; }
  .adash-header-actions { width: 100%; }
  .bcc-app .adash-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .adash-stats .adash-stat-value { font-size: var(--bcc-t-2xl); }
}

/* ── ≤480 phone ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .adash-header { flex-direction: column; align-items: flex-start; }
  .adash-header-actions { width: 100%; }
  .bcc-app .adash-refresh { width: 100%; min-height: 44px; }
  .bcc-app .adash-quick   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bcc-app .adash-quick-btn { min-height: 78px; }
  .adash-stats .adash-stat-value { font-size: var(--bcc-t-2xl); }
  .adash-stat-icon  { width: 32px; height: 32px; }
}

/* ================================================================
   REDUCED MOTION
   (Global rule in connect-tokens.css neutralizes transitions; this
   also keeps hover lifts static and the AI cursor calm.)
=============================================================== */
@media (prefers-reduced-motion: reduce) {
  .adash-stats .adash-stat:hover,
  .bcc-app .adash-quick-btn:hover,
  .bcc-app .adash-refresh:hover {
    transform: none;
  }
  .adash-stats .adash-stat-value { animation: none; }
  .adash-ai-cursor  { animation: none; }
}
