/* ═══════════════════════════════════════════════════
   DASHBOARD PAGE  —  Card-grid layout  (db- prefix)
   Mirrors Omagie reference design:
   grid-template-columns: 1fr 1fr 220px  ×  3 rows
═══════════════════════════════════════════════════ */

/* ── Top bar ── */
.db-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.5rem 1.75rem 0;
  gap: 1rem;
}
.db-topbar-left { flex: 1; }
.db-topbar-right { flex-shrink: 0; }
.db-hello {
  font-size: 1.55rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.2;
}
.db-sub {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.2rem;
}
.db-date-badge {
  font-size: 0.7rem;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Main content grid ── */
.db-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  grid-template-rows: auto auto auto;
  gap: 14px;
  padding: 1rem 1.75rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}
.db-grid::-webkit-scrollbar { width: 4px; }
.db-grid::-webkit-scrollbar-thumb { background: hsl(var(--primary) / 0.22); border-radius: 4px; }

/* ── Shared card ── */
.db-card {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(2, 132, 199, 0.14);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow:
    0 0 0 1px rgba(2,132,199,0.08),
    0 4px 28px rgba(2,132,199,0.10),
    inset 0 1px 0 rgba(255,255,255,0.90);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: dbFadeUp 0.55s ease both;
  overflow: hidden;
}

/* Top shimmer edge on all dashboard cards */
.db-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.55), rgba(2,132,199,0.30), transparent);
  pointer-events: none;
}
.db-card-title {
  font-size: 13px;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 2px;
}
.db-card-footer-link {
  font-size: 11px;
  color: hsl(var(--primary));
  text-decoration: none;
  margin-top: auto;
  font-weight: 500;
  transition: opacity 0.2s;
}
.db-card-footer-link:hover { opacity: 0.7; }

/* ── Grid placement ── */
.db-card-team     { grid-column: 1; grid-row: 1; }
.db-stats-col     { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 10px; }
.db-card-ring     { grid-column: 3; grid-row: 1; }
.db-card-chart    { grid-column: 1 / 3; grid-row: 2; }
.db-card-cal      { grid-column: 3; grid-row: 2; }
.db-card-activity { grid-column: 1 / 3; grid-row: 3; }
.db-card-actions  { grid-column: 3; grid-row: 3; }

/* Stagger animations */
.db-card-team     { animation-delay: 0.05s; }
.db-stats-col     { animation-delay: 0.10s; }
.db-card-ring     { animation-delay: 0.12s; }
.db-card-chart    { animation-delay: 0.18s; }
.db-card-cal      { animation-delay: 0.22s; }
.db-card-activity { animation-delay: 0.26s; }
.db-card-actions  { animation-delay: 0.30s; }

/* ── Team members list (col 1, row 1) ── */
.db-proj-list {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.db-proj-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(2, 132, 199, 0.08);
  cursor: default;
  transition: color 0.2s;
}
.db-proj-item:last-child { border-bottom: none; }
.db-proj-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.db-proj-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-proj-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.10);
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

/* ── Stat cards stacked in col 2 ── */
.db-stat-card {
  position: relative;
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  flex: 1;
  overflow: hidden;
}
.db-stat-card:hover {
  transform: translateY(-3px);
}

/* Decorative circles inside stat cards */
.db-stat-card::before {
  content: '';
  position: absolute;
  right: -22px;
  top: -22px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  pointer-events: none;
}
.db-stat-card::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 12px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.09);
  pointer-events: none;
}

/* Sky-blue gradient card (primary stat) */
.db-stat-gold {
  background: linear-gradient(135deg, #0369A1 0%, #0284C7 50%, #0EA5E9 100%);
  box-shadow: 0 8px 28px rgba(3,105,161,0.42), inset 0 1px 0 rgba(255,255,255,0.20);
}

/* Cyan/teal gradient card (secondary stat) */
.db-stat-rose {
  background: linear-gradient(135deg, #0891B2 0%, #06B6D4 50%, #22D3EE 100%);
  box-shadow: 0 8px 28px rgba(8,145,178,0.40), inset 0 1px 0 rgba(255,255,255,0.20);
}

/* Teal (unused, kept for flexibility) */
.db-stat-teal {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  box-shadow: 0 6px 20px rgba(13,148,136,0.35);
}

.db-stat-val {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}
.db-stat-lbl { font-size: 11px; color: rgba(255,255,255,0.82); margin-top: 4px; }
.db-stat-bar { opacity: 0.45; flex-shrink: 0; }

/* ── Progress ring (col 3, row 1) ── */
.db-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 6px;
}
.db-ring-container {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 6px 0;
}
.db-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.db-ring-pct {
  font-size: 22px;
  font-weight: 800;
  color: hsl(var(--foreground));
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}
.db-ring-sub   { font-size: 9px; color: hsl(var(--muted-foreground)); }
.db-ring-label { font-size: 11px; color: hsl(var(--muted-foreground)); text-align: center; }

/* ── Ring gradient (referenced inline via SVG defs) ── */
/* The JS inlines dbRingGrad — override stop colors via CSS filter isn't possible;
   the SVG gradient is purple by reference to the dashboardPage.js inline defs. */

/* ── Line chart (col 1-2, row 2) ── */
.db-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.db-chart-legend { display: flex; gap: 14px; }
.db-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.db-legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.db-chart-badge {
  font-size: 10px;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Calendar (col 3, row 2) ── */
.db-cal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.db-cal-sub { font-size: 10px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.db-cal-nav { display: flex; gap: 5px; }
.db-cal-arrow {
  background: none;
  border: 1px solid rgba(2, 132, 199, 0.20);
  border-radius: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  line-height: 1;
  transition: all 0.2s;
  padding: 0;
}
.db-cal-arrow:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.db-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.db-cal-heads span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
  padding: 3px 0;
}
.db-cal-day {
  font-size: 10px;
  padding: 4px 2px;
  border-radius: 6px;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  transition: all 0.15s;
}
.db-cal-day:hover { background: hsl(var(--primary) / 0.10); color: hsl(var(--primary)); }
.db-cal-empty { pointer-events: none; }
.db-cal-today {
  background: linear-gradient(135deg, #0284C7, #38BDF8);
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(2,132,199,0.52), 0 0 0 2px rgba(56,189,248,0.30);
  transform: scale(1.12);
}

/* ── Activity rows (col 1-2, row 3) ── */
.db-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(2, 132, 199, 0.06);
  font-size: 12px;
}
.db-activity-row:last-child { border-bottom: none; }
.db-act-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.db-act-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.db-act-ok           { background: rgba(34,197,94,0.14); }
.db-act-ok svg       { stroke: #22c55e; }
.db-act-fail         { background: rgba(239,68,68,0.14); }
.db-act-fail svg     { stroke: #f87171; }
.db-act-name         { flex: 1; font-weight: 600; color: hsl(var(--foreground)); }
.db-act-time         { color: hsl(var(--muted-foreground)); font-size: 11px; white-space: nowrap; }
.db-act-meta         { color: hsl(var(--primary)); font-weight: 600; font-size: 11px; white-space: nowrap; }
.db-act-status       { font-size: 10px; font-weight: 600; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.db-act-status-ok    { background: rgba(34,197,94,0.12); color: #16a34a; }
.db-act-status-fail  { background: rgba(239,68,68,0.12); color: #dc2626; }

/* ── Quick access list (col 3, row 3) ── */
.db-actions-list { display: flex; flex-direction: column; }
.db-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(2, 132, 199, 0.07);
  text-decoration: none;
  transition: color 0.18s;
}
.db-action-row:last-child { border-bottom: none; }
.db-action-row:hover .db-action-name { color: hsl(var(--primary)); }
.db-action-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.db-action-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: hsl(var(--foreground));
  transition: color 0.18s;
}
.db-action-tag {
  font-size: 10px;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Messages card ── */
.db-msg-list { display: flex; flex-direction: column; }
.db-msg-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(2, 132, 199, 0.07);
  text-decoration: none;
  transition: opacity 0.18s;
  align-items: center;
}
.db-msg-item:last-child { border-bottom: none; }
.db-msg-item:hover { opacity: 0.8; }
.db-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.db-msg-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.db-msg-name {
  font-size: 11px;
  font-weight: 700;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-msg-text { font-size: 10px; color: hsl(var(--muted-foreground)); }

/* ── Shared utility ── */
.db-empty {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  text-align: center;
  padding: 1.5rem 0;
}
.db-spinner-wrap { display: flex; justify-content: center; padding: 1.5rem 0; }
.db-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(2, 132, 199, 0.15);
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Keyframes ── */
@keyframes dbFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive breakpoints ── */
@media (max-width: 1100px) {
  .db-grid { grid-template-columns: 1fr 1fr 200px; }
}
@media (max-width: 860px) {
  .db-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .db-card-team     { grid-column: 1; grid-row: 1; }
  .db-stats-col     { grid-column: 2; grid-row: 1; }
  .db-card-ring     { grid-column: 1; grid-row: 2; }
  .db-card-cal      { grid-column: 2; grid-row: 2; }
  .db-card-chart    { grid-column: 1 / 3; grid-row: 3; }
  .db-card-activity { grid-column: 1 / 3; grid-row: 4; }
  .db-card-actions  { grid-column: 1 / 3; grid-row: 5; }
}
@media (max-width: 560px) {
  .db-topbar { padding: 1rem 1rem 0; flex-direction: column; align-items: flex-start; }
  .db-grid   { grid-template-columns: 1fr; padding: 0.75rem 1rem 1.5rem; gap: 10px; }
  .db-card-team, .db-stats-col, .db-card-ring, .db-card-chart,
  .db-card-cal, .db-card-activity, .db-card-actions {
    grid-column: 1;
    grid-row: auto;
  }
  .db-stats-col   { flex-direction: row; }
  .db-stat-card   { flex: 1; }
}
