/* ============================================================
   Outreach Command Center — Dashboard Styles
   Dark theme matching gp.advalorem.io
   ============================================================ */

/* --- Fonts --- */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cormorant:wght@400;500;600;700&display=swap');

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

:root {
  --bg-page: #0a0a0a;
  --bg-surface: #111111;
  --bg-surface-hover: #1a1a1a;
  --bg-surface-raised: #1e1e1e;
  --border: #2a2a2a;
  --border-light: #333;
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.15);
  --teal-hover: #5eead4;
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, 0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.15);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.15);
  --gray: #6b7280;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #666666;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Cormorant', Georgia, serif;
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

html { font-size: 14px; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-secondary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Login Screen --- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  color: var(--teal);
  margin-bottom: 0.5rem;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.login-card .login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.login-input:focus {
  border-color: var(--teal);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-btn {
  width: 100%;
  padding: 0.65rem;
  background: var(--teal);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.login-btn:hover {
  background: var(--teal-hover);
}

.login-error {
  color: var(--red);
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-top: 0.25rem;
}

/* --- Dashboard Layout --- */
.dashboard {
  display: none;
}

.dashboard.active {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar Navigation --- */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.sidebar-brand svg {
  color: var(--teal);
  flex-shrink: 0;
}

.sidebar-brand span {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-left: 0.15rem;
}

.sidebar-meta a {
  color: var(--teal);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.sidebar-meta a:hover { opacity: 1; }

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.nav-item.active {
  color: var(--teal);
  background: var(--teal-dim);
  border-left-color: var(--teal);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.sidebar-footer a:hover {
  color: var(--teal);
}

/* --- Main Content --- */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
}

.top-bar-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 0.35rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.content-area {
  padding: 1.5rem;
}

/* --- Section Panels --- */
.section-panel {
  display: none;
}

.section-panel.active {
  display: block;
}

/* --- KPI Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  transition: border-color var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-light);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-value .kpi-secondary {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-delta {
  font-size: 0.72rem;
  margin-top: 0.35rem;
  font-weight: 500;
}

.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }
.kpi-delta.neutral { color: var(--text-muted); }

/* --- Progress Bar --- */
.progress-bar-container {
  margin-top: 0.5rem;
}

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--bg-page);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Cards & Panels --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-teal { background: var(--teal-dim); color: var(--teal); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-gray { background: rgba(107, 114, 128, 0.15); color: var(--gray); }

.card-body {
  padding: 1rem;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--bg-surface-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

.email-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Status indicators --- */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.status-sent { background: var(--teal); }
.status-error { background: var(--red); }
.status-bounce { background: var(--orange); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

/* --- Chart container --- */
.chart-container {
  position: relative;
  width: 100%;
  height: 200px;
  padding: 0.5rem 0;
}

/* --- Event Timeline --- */
.event-list {
  list-style: none;
}

.event-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
  transition: background var(--transition);
  border-left: 3px solid transparent;
}

.event-item:hover {
  background: var(--bg-surface-hover);
}

.event-item:last-child {
  border-bottom: none;
}

.event-item.interested {
  border-left-color: var(--green);
}

.event-item.bounce {
  border-left-color: var(--orange);
}

.event-item.stop {
  border-left-color: var(--red);
}

.event-item.ooo {
  border-left-color: var(--yellow);
}

.event-item.neutral {
  border-left-color: var(--gray);
}

.event-item.nurture-sent {
  border-left-color: var(--teal);
}

.event-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
  padding-top: 0.1rem;
}

.event-content {
  flex: 1;
  min-width: 0;
}

.event-email {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.event-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.event-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding: 0.5rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  display: none;
  line-height: 1.4;
  max-height: 80px;
  overflow: hidden;
}

.event-item:hover .event-preview,
.event-item.expanded .event-preview {
  display: block;
}

.event-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Suppression List --- */
.suppression-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--teal);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  padding: 0.3rem 0;
  transition: opacity var(--transition);
}

.suppression-toggle:hover { opacity: 0.8; }

.suppression-list {
  display: none;
  margin-top: 0.5rem;
}

.suppression-list.open {
  display: block;
}

.suppression-list ul {
  list-style: none;
  padding: 0;
}

.suppression-list li {
  font-size: 0.78rem;
  padding: 0.3rem 0;
  color: var(--text-muted);
  font-family: monospace;
}

/* --- Grid layouts for section content --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* --- Inbox breakdown mini-table --- */
.inbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.inbox-name {
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.72rem;
}

.inbox-count {
  color: var(--teal);
  font-weight: 600;
}

/* --- Warmup section --- */
.warmup-progress {
  margin-bottom: 1.25rem;
}

.warmup-bar-bg {
  width: 100%;
  height: 12px;
  background: var(--bg-page);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.warmup-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-hover));
  border-radius: 6px;
  transition: width 0.5s ease;
}

.warmup-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Footer --- */
.dashboard-footer {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.dashboard-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.dashboard-footer a:hover {
  color: var(--teal);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar {
    width: 56px;
    min-width: 56px;
  }
  .sidebar-brand span,
  .sidebar-meta,
  .nav-item span,
  .sidebar-footer {
    display: none;
  }
  .sidebar-header {
    padding: 1rem 0.5rem;
    display: flex;
    justify-content: center;
  }
  .sidebar-brand {
    justify-content: center;
  }
  .nav-item {
    justify-content: center;
    padding: 0.75rem;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .nav-item.active {
    border-left: none;
    border-bottom-color: var(--teal);
  }
  .main-content {
    margin-left: 56px;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .three-col {
    grid-template-columns: 1fr 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .dashboard.active {
    flex-direction: column;
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar {
    display: none;
  }
  /* Mobile: show horizontal tab bar */
  .mobile-nav {
    display: flex !important;
    overflow-x: auto;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    gap: 0.25rem;
    position: sticky;
    top: 0;
    z-index: 49;
    width: 100%;
    height: auto;
    flex-direction: row;
  }
  .mobile-nav .nav-item {
    padding: 0.6rem 0.75rem;
    border-left: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
  }
  .mobile-nav .nav-item.active {
    border-left: none;
    background: var(--teal-dim);
  }
  .mobile-nav .nav-item svg { display: none; }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .three-col {
    grid-template-columns: 1fr;
  }
  .inbox-grid {
    grid-template-columns: 1fr;
  }
  .content-area {
    padding: 1rem;
  }
  .top-bar {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .top-bar-title {
    font-size: 1.1rem;
  }
  .top-bar-meta {
    font-size: 0.7rem;
    gap: 0.5rem;
  }
}

.mobile-nav {
  display: none;
  flex-shrink: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* --- Utility --- */
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.82em; }
.text-teal { color: var(--teal); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-primary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
