/* Hope Council Prevention Grant — Campaign Dashboard */

:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --phase-1: #4F46E5;
  --phase-2: #0891B2;
  --phase-3: #059669;
  --phase-4: #D97706;
  --priority-high: #EF4444;
  --priority-medium: #F59E0B;
  --priority-low: #6B7280;
  --status-done: #059669;
  --status-progress: #3B82F6;
  --status-not: #D1D5DB;
  --sidebar-width: 260px;
  --header-height: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #1F2937;
  color: #F9FAFB;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 180px;
  height: auto;
  filter: brightness(0) invert(1);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B7280;
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #D1D5DB;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #FFFFFF; }
.nav-item.active { background: rgba(255,255,255,0.1); color: #FFFFFF; }

.nav-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-progress {
  margin-left: auto;
  font-size: 11px;
  color: #6B7280;
  font-weight: 600;
}

/* ── Main Layout ── */

.main {
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: #4F46E5;
  color: #FFFFFF;
}
.btn-primary:hover { background: #4338CA; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Dashboard ── */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.phase-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.phase-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.phase-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 20px;
  color: #FFFFFF;
}

.phase-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.phase-card .date-range {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.progress-bar-container {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.phase-card .stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.phase-card .stats strong {
  color: var(--text);
}

/* ── Metrics Grid ── */

.metrics-section {
  margin-top: 12px;
}

.metrics-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-card .metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.metric-card .metric-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.metric-card .metric-current {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.metric-card .metric-target {
  font-size: 13px;
  color: var(--text-muted);
}

.metric-bar-container {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.metric-bar {
  height: 100%;
  background: #4F46E5;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Phase View ── */

.phase-header {
  margin-bottom: 24px;
}

.phase-header .phase-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.phase-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.phase-header .phase-goal {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.6;
}

.phase-header .phase-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.category-section {
  margin-bottom: 24px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  cursor: pointer;
  user-select: none;
}

.category-header:hover { background: #FAFAFA; }

.category-header h4 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-header .category-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.category-header .chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.category-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.task-list {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.task-list.collapsed { display: none; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s ease;
}

.task-item:last-child { border-bottom: none; }
.task-item:hover { background: #FAFBFC; }

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 1px;
  transition: all 0.15s ease;
}

.task-checkbox:hover { border-color: #4F46E5; }

.task-checkbox.checked {
  background: var(--status-done);
  border-color: var(--status-done);
  color: #FFFFFF;
}

.task-checkbox.in-progress {
  background: var(--status-progress);
  border-color: var(--status-progress);
  color: #FFFFFF;
}

.task-checkbox .check-icon { font-size: 12px; line-height: 1; }

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

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.priority-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.priority-tag.high { background: #FEE2E2; color: #DC2626; }
.priority-tag.medium { background: #FEF3C7; color: #D97706; }
.priority-tag.low { background: #F3F4F6; color: #6B7280; }

.task-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.task-indicators span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-item:hover .task-actions { opacity: 1; }

.task-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.1s ease;
}

.task-action-btn:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section:last-child { margin-bottom: 0; }

.modal-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.modal-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.status-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.status-select:focus { outline: none; border-color: #4F46E5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* Comments */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.comment {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.comment-date {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.comment-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
}

.comment-delete:hover { color: var(--priority-high); background: #FEE2E2; }

.comment-input-row {
  display: flex;
  gap: 8px;
}

.comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 36px;
}

.comment-input:focus { outline: none; border-color: #4F46E5; }

/* Files */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
}

.file-item .file-icon { font-size: 16px; }
.file-item .file-name { flex: 1; color: var(--text); font-weight: 500; }
.file-item .file-size { color: var(--text-muted); font-size: 11px; }

.file-item .file-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
}

.file-item .file-delete:hover { color: var(--priority-high); }

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.file-upload-btn:hover {
  border-color: #4F46E5;
  color: #4F46E5;
  background: rgba(79,70,229,0.04);
}

/* ── Metrics View ── */

.metrics-header {
  margin-bottom: 24px;
}

.metrics-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.metrics-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.metric-edit-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-edit-card .metric-info { flex: 1; }

.metric-edit-card .metric-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.metric-edit-card .metric-target-label {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-input {
  width: 100px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.metric-input:focus {
  outline: none;
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.metrics-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

/* ── Responsive ── */

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle { display: block; }
  .content { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metrics-edit-grid { grid-template-columns: 1fr; }
  .modal { width: 95%; margin: 0 10px; }
}

/* ── Plan Overview ── */

.plan-overview {
  max-width: 900px;
}

.plan-hero {
  margin-bottom: 32px;
}

.plan-hero h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.plan-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.plan-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.plan-section {
  margin-bottom: 36px;
}

.plan-section h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.plan-section > p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.plan-audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.plan-audience-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.plan-audience-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.plan-audience-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.plan-audience-card p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.plan-message-primary,
.plan-message-secondary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.plan-message-primary {
  border-left: 4px solid #4F46E5;
}

.plan-message-secondary {
  border-left: 4px solid #0891B2;
}

.plan-message-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.plan-section blockquote {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-style: italic;
  margin: 0;
}

.plan-phase-block {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.plan-phase-header {
  padding: 18px 22px;
  border-left: 4px solid;
}

.plan-phase-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.plan-phase-title-row h4 {
  font-size: 16px;
  font-weight: 700;
}

.plan-phase-dates {
  font-size: 12px;
  color: var(--text-muted);
}

.plan-phase-goal {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.plan-phase-categories {
  border-top: 1px solid var(--border);
}

.plan-category {
  border-bottom: 1px solid var(--border-light);
}

.plan-category:last-child {
  border-bottom: none;
}

.plan-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: #FAFBFC;
  font-size: 13px;
  font-weight: 600;
}

.plan-category-id {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.plan-category-name {
  color: var(--text);
}

.plan-category-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.plan-task-list {
  padding: 0 22px;
}

.plan-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

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

.plan-task-icon {
  font-size: 11px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.plan-task-done .plan-task-icon { color: var(--status-done); }
.plan-task-progress .plan-task-icon { color: var(--status-progress); }

.plan-task-title {
  color: var(--text);
}

.plan-task-done .plan-task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.plan-metrics-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 13px;
}

.plan-metrics-table thead {
  background: #FAFBFC;
}

.plan-metrics-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.plan-metrics-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.plan-metrics-table tr:last-child td {
  border-bottom: none;
}

.plan-metric-target {
  font-weight: 600;
  color: var(--text-secondary);
}

.plan-metric-current {
  font-weight: 700;
}

/* ── Utility ── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.fade-in {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Print */
@media print {
  .sidebar, .header, .task-actions, .modal-overlay { display: none !important; }
  .main { margin-left: 0; }
  .content { overflow: visible; }
}
