/* ========================================================
   PHASE 10 — INTERACTIVITY & ENGAGEMENT LAYER
   Features: Time Greeting, Doc Expiry, Streak, Skeletons,
             Watching Bar, Today's Focus, Activity Feed
   ======================================================== */

/* ===== 1. TIME-AWARE GREETING ===== */
.greeting-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.greeting-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}
.greeting-sub {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
  font-weight: 400;
}
.greeting-sub strong {
  color: var(--color-primary);
  font-weight: 600;
}
.greeting-day-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.greeting-day-counter i {
  width: 13px;
  height: 13px;
}

/* ===== 2. ACTIVITY STREAK ===== */
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full, 9999px);
  background: rgba(245,158,11,0.2);
  color: #fbbf24;
  white-space: nowrap;
  animation: streakPulse 3s ease-in-out infinite;
  backdrop-filter: blur(4px);
}
.streak-pill .streak-fire {
  font-size: 0.85rem;
  line-height: 1;
}
.streak-pill.streak-hot {
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(245,158,11,0.12));
  color: #dc2626;
}
.streak-pill.streak-blaze {
  background: linear-gradient(135deg, rgba(239,68,68,0.18), rgba(168,85,247,0.12));
  color: #dc2626;
}
[data-theme="dark"] .streak-pill {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(239,68,68,0.1));
  color: #fbbf24;
}
[data-theme="dark"] .streak-pill.streak-hot {
  background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(245,158,11,0.15));
  color: #f87171;
}
@keyframes streakPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ===== 3. SETTLEWELL IS WATCHING STATUS BAR ===== */
/* ===== CHYRON BAR ===== */
.sw-watching-bar {
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-faint);
  letter-spacing: 0.02em;
  background: var(--color-surface-offset, #edf0f4);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  flex-shrink: 0;
  height: 28px;
}
[data-theme="dark"] .sw-watching-bar {
  background: var(--color-surface-offset, #151e2e);
}

/* "LIVE" badge on the left */
.sw-chyron-live {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  height: 100%;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-success, #22c55e);
  background: var(--color-surface-offset, #edf0f4);
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  border-right: 1px solid rgba(128,128,128,0.12);
}
[data-theme="dark"] .sw-chyron-live {
  background: var(--color-surface-offset, #151e2e);
}
.sw-watching-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success, #22c55e);
  animation: watchingDotPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes watchingDotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* Scrolling track */
.sw-chyron-track {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
/* Fade edges */
.sw-chyron-track::before,
.sw-chyron-track::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 2.5rem;
  z-index: 2;
  pointer-events: none;
}
.sw-chyron-track::before {
  left: 0;
  background: linear-gradient(90deg, var(--color-surface-offset, #edf0f4), transparent);
}
.sw-chyron-track::after {
  right: 0;
  background: linear-gradient(270deg, var(--color-surface-offset, #edf0f4), transparent);
}
[data-theme="dark"] .sw-chyron-track::before {
  background: linear-gradient(90deg, var(--color-surface-offset, #151e2e), transparent);
}
[data-theme="dark"] .sw-chyron-track::after {
  background: linear-gradient(270deg, var(--color-surface-offset, #151e2e), transparent);
}

/* The tape — two copies side by side, scrolling left */
.sw-chyron-tape {
  display: flex;
  white-space: nowrap;
  animation: chyronScroll 45s linear infinite;
  will-change: transform;
}
.sw-chyron-tape:hover {
  animation-play-state: paused;
}
.sw-chyron-copy {
  flex-shrink: 0;
  padding-right: 0;
}
@keyframes chyronScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
/* Chyron mobile: not sticky, scrolls away naturally */
@media (max-width: 768px) {
  .sw-watching-bar {
    position: relative;
    top: auto;
    z-index: auto;
    height: 26px;
    font-size: 0.62rem;
  }
  .sw-chyron-live {
    padding: 0 0.5rem;
    font-size: 0.55rem;
  }
}

/* ===== 4. TODAY'S FOCUS CARD ===== */
.todays-focus-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-lg, 1rem);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast, 180ms), box-shadow var(--transition-fast, 180ms);
}
.todays-focus-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(44,74,124,0.1);
}
.todays-focus-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent, #c44b4b));
  border-radius: 3px 3px 0 0;
}
.todays-focus-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md, 0.625rem);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}
.todays-focus-icon i {
  width: 20px;
  height: 20px;
}
.todays-focus-body {
  flex: 1;
  min-width: 0;
}
.todays-focus-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  margin-bottom: 0.2rem;
}
.todays-focus-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 0.2rem;
}
.todays-focus-meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.todays-focus-meta strong {
  color: var(--color-primary);
}
.todays-focus-cta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  align-self: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.todays-focus-cta i {
  width: 14px;
  height: 14px;
}
[data-theme="dark"] .todays-focus-card {
  background: var(--color-surface);
  border-color: var(--color-primary);
}
[data-theme="dark"] .todays-focus-card:hover {
  box-shadow: 0 4px 20px rgba(91,156,245,0.12);
}

/* ===== 5. DOCUMENT EXPIRY TIMERS ===== */
.doc-expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full, 9999px);
  white-space: nowrap;
  margin-left: 0.4rem;
}
.doc-expiry-badge i {
  width: 11px;
  height: 11px;
}
.doc-expiry-badge.expiry-green {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.doc-expiry-badge.expiry-yellow {
  background: rgba(245,158,11,0.12);
  color: #d97706;
  animation: expiryPulseYellow 3s ease-in-out infinite;
}
.doc-expiry-badge.expiry-red {
  background: rgba(239,68,68,0.12);
  color: #dc2626;
  animation: expiryPulseRed 1.5s ease-in-out infinite;
}
.doc-expiry-badge.expiry-expired {
  background: rgba(239,68,68,0.15);
  color: #dc2626;
  font-weight: 700;
}
[data-theme="dark"] .doc-expiry-badge.expiry-green {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
}
[data-theme="dark"] .doc-expiry-badge.expiry-yellow {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
}
[data-theme="dark"] .doc-expiry-badge.expiry-red {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}
@keyframes expiryPulseYellow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}
@keyframes expiryPulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ===== 6. SKELETON LOADING ===== */
.skeleton-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-bg);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  transition: opacity 0.4s ease;
}
.skeleton-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.skeleton-block {
  border-radius: var(--radius-md, 0.625rem);
  background: var(--color-surface);
  overflow: hidden;
  position: relative;
}
.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--color-surface-offset, rgba(255,255,255,0.5)), transparent);
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skel-banner {
  height: 140px;
  border-radius: var(--radius-lg, 1rem);
}
.skel-focus {
  height: 72px;
  border-radius: var(--radius-lg, 1rem);
}
.skel-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.skel-kpi {
  height: 100px;
  border-radius: var(--radius-md, 0.625rem);
}
.skel-card {
  height: 180px;
  border-radius: var(--radius-lg, 1rem);
}
.skel-card-sm {
  height: 120px;
  border-radius: var(--radius-lg, 1rem);
}
[data-theme="dark"] .skeleton-block::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}

/* ===== 7. UNIFIED ACTIVITY FEED / NOTIFICATION CENTER ===== */
.notification-bell-wrap {
  position: relative;
}
.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent, #c44b4b);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--color-surface);
  animation: notifBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes notifBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.notif-panel {
  position: fixed;
  top: 52px;
  right: 1rem;
  width: 380px;
  max-height: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 1rem);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}
.notif-panel.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.notif-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}
.notif-mark-read {
  font-size: 0.72rem;
  color: var(--color-primary);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
}
.notif-mark-read:hover {
  text-decoration: underline;
}
.notif-panel-body {
  overflow-y: auto;
  flex: 1;
  padding: 0.25rem 0;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background var(--transition-fast, 180ms);
  position: relative;
}
.notif-item:hover {
  background: var(--color-primary-light);
}
.notif-item.unread {
  background: var(--color-primary-light);
}
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}
.notif-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-icon-circle i {
  width: 15px;
  height: 15px;
}
.notif-icon-circle.notif-policy {
  background: rgba(245,158,11,0.12);
  color: #d97706;
}
.notif-icon-circle.notif-doc {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.notif-icon-circle.notif-draw {
  background: rgba(91,156,245,0.1);
  color: var(--color-primary);
}
.notif-icon-circle.notif-ai {
  background: rgba(168,85,247,0.1);
  color: #8b5cf6;
}
.notif-icon-circle.notif-milestone {
  background: rgba(236,72,153,0.1);
  color: #ec4899;
}
.notif-icon-circle.notif-system {
  background: var(--color-surface-offset, #edf0f4);
  color: var(--color-text-muted);
}
.notif-body {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 0.1rem;
}
.notif-desc {
  font-size: 0.73rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.notif-time {
  font-size: 0.65rem;
  color: var(--color-text-faint);
  margin-top: 0.15rem;
  display: block;
}
.notif-panel-footer {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.notif-panel-footer a {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.notif-panel-footer a:hover {
  text-decoration: underline;
}
[data-theme="dark"] .notif-icon-circle.notif-policy {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
}
[data-theme="dark"] .notif-icon-circle.notif-doc {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
}
[data-theme="dark"] .notif-icon-circle.notif-draw {
  background: rgba(91,156,245,0.15);
  color: #7bb8ff;
}
[data-theme="dark"] .notif-icon-circle.notif-ai {
  background: rgba(168,85,247,0.15);
  color: #a78bfa;
}
[data-theme="dark"] .notif-icon-circle.notif-milestone {
  background: rgba(236,72,153,0.15);
  color: #f472b6;
}

/* ===== 8. TOAST NOTIFICATION SYSTEM ===== */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 0.625rem);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,0.12));
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.toast.toast-exit {
  animation: toastSlideOut 0.25s ease forwards;
}
@keyframes toastSlideIn {
  0% { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes toastSlideOut {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(40px); }
}
.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.toast-icon.toast-success { color: #16a34a; }
.toast-icon.toast-warning { color: #d97706; }
.toast-icon.toast-info { color: var(--color-primary); }
.toast-body {
  flex: 1;
}
.toast-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}
.toast-msg {
  font-size: 0.73rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 0 0 0 var(--radius-md, 0.625rem);
  animation: toastCountdown 5s linear forwards;
}
@keyframes toastCountdown {
  0% { width: 100%; }
  100% { width: 0%; }
}
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 0;
  flex-shrink: 0;
}
.toast-close:hover {
  color: var(--color-text);
}
.toast-close i {
  width: 14px;
  height: 14px;
}

/* ===== 9. AI BREATHING DOT (Chat nav item) ===== */
.ai-breathing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  margin-left: 0.35rem;
  animation: aiBreath 2.5s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes aiBreath {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(34,197,94,0.3); }
  50% { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* ===== 10. SECTION TRANSITION ANIMATION ===== */
.section {
  animation: none;
}
.section.section-active {
  animation: sectionFadeIn 0.3s ease;
}
@keyframes sectionFadeIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .greeting-text { font-size: 1.25rem; }
  .skel-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .notif-panel { width: calc(100vw - 2rem); right: -1rem; }
  .toast-container { left: 1rem; right: 1rem; }
  .toast { min-width: auto; max-width: none; }
  .todays-focus-card { flex-wrap: wrap; }
  .todays-focus-cta { margin-top: 0.35rem; }
  /* chyron mobile handled in responsive.css */
}
