/* ============================================================
   Morning Dashboard — Design System & Styles
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Background */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-card-border: rgba(255, 255, 255, 0.08);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accents */
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #3b82f6);

  /* Priority Colors */
  --priority-urgent: #ef4444;
  --priority-urgent-bg: rgba(239, 68, 68, 0.12);
  --priority-urgent-border: rgba(239, 68, 68, 0.25);
  --priority-high: #f59e0b;
  --priority-high-bg: rgba(245, 158, 11, 0.12);
  --priority-high-border: rgba(245, 158, 11, 0.25);
  --priority-normal: #22c55e;
  --priority-normal-bg: rgba(34, 197, 94, 0.12);
  --priority-normal-border: rgba(34, 197, 94, 0.25);

  /* Event Type Colors */
  --event-meeting: #3b82f6;
  --event-call: #8b5cf6;
  --event-deadline: #ef4444;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.2);
  --shadow-glow-purple: 0 0 40px rgba(139, 92, 246, 0.15);
  --shadow-glow-blue: 0 0 40px rgba(59, 130, 246, 0.15);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-xs: 0.75rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-md: 1.0625rem;
  --font-lg: 1.25rem;
  --font-xl: 1.5rem;
  --font-2xl: 2rem;
  --font-3xl: 2.5rem;

  /* Transition */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background ambient glow */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Layout --- */
.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* --- Header --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
}

.greeting h1 {
  font-size: var(--font-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.greeting h1 .wave {
  display: inline-block;
  -webkit-text-fill-color: initial;
  animation: wave 2.5s ease-in-out infinite;
  transform-origin: 70% 70%;
}

.header-meta {
  text-align: right;
}

.header-date {
  font-size: var(--font-base);
  color: var(--text-secondary);
  font-weight: 500;
}

.header-updated {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* --- Stat Cards --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: all var(--transition-base);
  cursor: default;
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.urgent {
  background: var(--priority-urgent-bg);
  color: var(--priority-urgent);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.stat-icon.leads {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.stat-icon.overdue {
  background: rgba(245, 158, 11, 0.12);
  color: var(--priority-high);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.stat-number {
  font-size: var(--font-3xl);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Section (shared) --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--font-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-badge {
  font-size: var(--font-xs);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 4px 10px;
  border-radius: 20px;
}

/* --- Main Grid (Priority + Leads) --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

/* --- Glass Panel --- */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
  animation-delay: 0.35s;
}

.glass-panel:nth-child(2) {
  animation-delay: 0.45s;
}

/* --- Priority Item Cards --- */
.priority-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.priority-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border-left: 3px solid transparent;
  transition: all var(--transition-base);
  cursor: default;
}

.priority-card:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.priority-card.urgent { border-left-color: var(--priority-urgent); }
.priority-card.high   { border-left-color: var(--priority-high); }
.priority-card.normal { border-left-color: var(--priority-normal); }

.priority-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-sm);
}

.priority-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.priority-badge.urgent {
  background: var(--priority-urgent-bg);
  color: var(--priority-urgent);
  border: 1px solid var(--priority-urgent-border);
}

.priority-badge.high {
  background: var(--priority-high-bg);
  color: var(--priority-high);
  border: 1px solid var(--priority-high-border);
}

.priority-badge.normal {
  background: var(--priority-normal-bg);
  color: var(--priority-normal);
  border: 1px solid var(--priority-normal-border);
}

.priority-category {
  font-size: var(--font-xs);
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 4px;
}

.priority-title {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.priority-description {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

.priority-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.priority-meta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.priority-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.priority-meta-item.overdue {
  color: var(--priority-urgent);
}

/* --- Lead Cards --- */
.leads-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.lead-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  cursor: default;
  border: 1px solid transparent;
}

.lead-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--bg-card-border);
  transform: translateX(4px);
}

.lead-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-sm);
  flex-shrink: 0;
  color: white;
}

.lead-name {
  font-size: var(--font-base);
  font-weight: 600;
}

.lead-title-company {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.lead-notes {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

.lead-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-xs);
}

.lead-followup {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.lead-followup svg {
  width: 14px;
  height: 14px;
}

.lead-source {
  font-size: 0.6875rem;
  color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* --- LinkedIn Link --- */
.lead-linkedin {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  text-decoration: none;
}

.lead-linkedin svg {
  width: 16px;
  height: 16px;
}

.lead-linkedin:hover {
  color: #0a66c2;
  background: rgba(10, 102, 194, 0.12);
  border-color: rgba(10, 102, 194, 0.3);
  transform: scale(1.1);
}

/* --- Outreach Message Block --- */
.outreach-block {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  position: relative;
}

.outreach-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-purple);
  margin-bottom: var(--space-sm);
}

.outreach-message {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.outreach-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-xs);
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.outreach-copy-btn svg {
  width: 14px;
  height: 14px;
}

.outreach-copy-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
}

.outreach-copy-btn.copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--priority-normal);
}

.lead-followup.overdue {
  color: var(--priority-urgent);
}

/* --- Timeline --- */
.timeline-section {
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
  animation-delay: 0.55s;
}

.timeline-section .glass-panel {
  opacity: 1;
  animation: none;
}

.timeline-track {
  position: relative;
  padding: var(--space-lg) 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-card-border) transparent;
}

.timeline-track::-webkit-scrollbar {
  height: 6px;
}

.timeline-track::-webkit-scrollbar-thumb {
  background: var(--bg-card-border);
  border-radius: 3px;
}

.timeline-line {
  position: relative;
  display: flex;
  gap: var(--space-lg);
  padding-bottom: var(--space-md);
  min-width: max-content;
}

.timeline-line::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bg-card-border);
  transform: translateY(-50%);
  z-index: 0;
}

.timeline-event {
  position: relative;
  z-index: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  min-width: 180px;
  max-width: 220px;
  transition: all var(--transition-base);
  cursor: default;
}

.timeline-event:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.timeline-event::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--bg-primary);
}

.timeline-event.meeting::before { border-color: var(--event-meeting); box-shadow: 0 0 8px rgba(59, 130, 246, 0.4); }
.timeline-event.call::before    { border-color: var(--event-call); box-shadow: 0 0 8px rgba(139, 92, 246, 0.4); }
.timeline-event.deadline::before { border-color: var(--event-deadline); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }

.timeline-event.overdue {
  border-color: var(--priority-urgent-border);
  background: rgba(239, 68, 68, 0.05);
}

.timeline-event-date {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.timeline-event-title {
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.timeline-event-time {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.timeline-event-type {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 6px;
}

.timeline-event.meeting .timeline-event-type {
  background: rgba(59, 130, 246, 0.12);
  color: var(--event-meeting);
}

.timeline-event.call .timeline-event-type {
  background: rgba(139, 92, 246, 0.12);
  color: var(--event-call);
}

.timeline-event.deadline .timeline-event-type {
  background: rgba(239, 68, 68, 0.12);
  color: var(--event-deadline);
}

/* --- Today Marker --- */
.today-marker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gradient);
  color: white;
  font-size: var(--font-xs);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  align-self: center;
}

.today-marker .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  animation: pulse 2s ease-in-out infinite;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: var(--space-xl) 0;
  font-size: var(--font-xs);
  color: var(--text-muted);
  opacity: 0;
  animation: fadeSlideUp 0.6s ease forwards;
  animation-delay: 0.65s;
}

/* --- Animations --- */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-8deg); }
  40% { transform: rotate(14deg); }
  50% { transform: rotate(-4deg); }
  60% { transform: rotate(10deg); }
  70% { transform: rotate(0deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.empty-state p {
  font-size: var(--font-sm);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard {
    padding: var(--space-lg) var(--space-md);
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .header-meta {
    text-align: left;
  }

  .greeting h1 {
    font-size: var(--font-2xl);
  }

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

  .stat-card {
    padding: var(--space-md) var(--space-lg);
  }

  .stat-number {
    font-size: var(--font-xl);
  }
}
