/* ================================================================
   RESOLVIT CARE — Social Operations Intelligence Module
   ================================================================ */

/* --- CORE APP SHELL --- */
body.care-mode {
  background: #020617; /* Deep Navy */
  color: #f8fafc;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  display: flex;
  height: 100dvh;
  margin: 0;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

#care-app {
  display: flex;
  width: 100vw;
  height: 100dvh;
}

/* --- SIDEBAR --- */
.care-sidebar {
  width: 280px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: all 0.3s ease;
}

.care-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.care-logo-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
}

.care-logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #a5b4fc, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.care-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.care-nav::-webkit-scrollbar { width: 4px; }
.care-nav::-webkit-scrollbar-track { background: transparent; }
.care-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

.care-nav-item {
  padding: 12px 16px;
  border-radius: 12px;
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid transparent;
}

.care-nav-item i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.care-nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}

.care-nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.1);
}

.care-nav-item.active i {
  color: #818cf8;
  text-shadow: 0 0 8px rgba(129, 140, 248, 0.6);
}

.care-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-left: auto;
  box-shadow: 0 0 8px #ef4444;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.care-sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.care-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* --- MAIN CONTENT AREA --- */
.care-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.care-topbar {
  height: 72px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
}

.care-view-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.care-topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.care-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.care-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.care-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.care-btn-outline {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
}

.care-btn-outline:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.care-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.care-view {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.care-view.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

/* --- PREMIUM UI COMPONENTS --- */

.care-panel {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.care-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.care-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.care-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* KPI Tiles */
.care-kpi-tile {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.care-kpi-tile:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.care-kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  margin-bottom: 8px;
}

.care-kpi-label {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.care-kpi-trend {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.trend-up { background: rgba(16, 185, 129, 0.1); color: #34d399; }
.trend-down { background: rgba(239, 68, 68, 0.1); color: #f87171; }

.kpi-accent-red { border-bottom: 2px solid #ef4444; }
.kpi-accent-blue { border-bottom: 2px solid #3b82f6; }
.kpi-accent-green { border-bottom: 2px solid #10b981; }
.kpi-accent-violet { border-bottom: 2px solid #8b5cf6; }

/* AI Insight Box */
.ai-insight-box {
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(168,85,247,0.05));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-left: 3px solid #8b5cf6;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  gap: 16px;
}

.ai-insight-icon {
  font-size: 1.5rem;
  color: #a5b4fc;
}

.ai-insight-content p {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.ai-insight-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Feed List (Intake / Timeline) */
.care-feed-item {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  gap: 16px;
}

.care-feed-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.feed-urgency-indicator {
  width: 4px;
  border-radius: 2px;
}
.urgency-crit { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5);}
.urgency-high { background: #f97316; }
.urgency-med { background: #eab308; }

.feed-content { flex: 1; }
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.feed-title {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin: 0;
}
.feed-meta {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Kanban Board (Task Orchestration) */
.kanban-board {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 600px;
}

.kanban-column {
  flex: 0 0 320px;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.kanban-count {
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.kanban-cards {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.task-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  cursor: grab;
  transition: all 0.2s;
}

.task-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.task-id { font-size: 0.75rem; color: #64748b; margin-bottom: 4px; }
.task-title { font-size: 0.9rem; font-weight: 500; color: white; margin-bottom: 12px; line-height: 1.4; }
.task-footer { display: flex; justify-content: space-between; align-items: center; }
.task-avatars { display: flex; }
.task-avatar { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #1e293b; margin-left: -8px; background: #334155; }
.task-avatar:first-child { margin-left: 0; }

/* Volunteer Cards */
.volunteer-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s;
}
.volunteer-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}
.vol-header { display: flex; gap: 16px; align-items: center;}
.vol-avatar { width: 48px; height: 48px; border-radius: 12px; background: #334155; }
.vol-info h4 { margin: 0 0 4px 0; font-size: 1rem; color: white;}
.vol-info p { margin: 0; font-size: 0.8rem; color: #94a3b8;}
.vol-badge { font-size: 0.7rem; padding: 2px 6px; background: rgba(16, 185, 129, 0.1); color: #34d399; border-radius: 4px;}
.vol-match-score { 
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), transparent);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vol-score-val { font-size: 1.25rem; font-weight: 700; color: #34d399;}

/* Specialized Views layout */
.split-view {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
  height: calc(100dvh - 140px);
}

.side-panel-scroll {
  overflow-y: auto;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Map Container for Intelligence View */
.intelligence-map-container {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  position: relative;
  background: #020617;
  height: 100%;
}

/* AI Routing Logic Flow */
.routing-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  background: rgba(0,0,0,0.2);
  border-radius: 16px;
  gap: 12px;
}

.flow-node {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 16px 24px;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  width: auto;
  min-width: 120px;
}
.flow-arrow {
  color: #6366f1;
  font-size: 1.5rem;
}

/* Hero Overview */
.care-hero {
  position: relative;
  padding: 60px 40px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.2));
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.care-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="2" cy="2" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
  z-index: -1;
}

.hero-text h1 { font-size: 2.8rem; margin-bottom: 12px; font-weight: 900; background: linear-gradient(135deg, #fff, #a5b4fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.hero-text p { font-size: 1.1rem; color: #cbd5e1; max-width: 600px; line-height: 1.6;}

/* Progress bars */
.progress-bg { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin-top: 8px;}
.progress-bar { height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: 3px;}

/* Timeline */
.timeline-track {
  border-left: 2px solid rgba(255,255,255,0.1);
  margin-left: 20px;
  padding-left: 30px;
}
.timeline-item {
  position: relative;
  margin-bottom: 32px;
}
.timeline-dot {
  position: absolute;
  left: -37px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6366f1;
  border: 4px solid #0f172a;
}
.timeline-content {
  background: rgba(255,255,255,0.03);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
.timeline-time { font-size: 0.8rem; color: #64748b; margin-bottom: 4px;}
.timeline-title { font-weight: 600; font-size: 1rem; color: white; margin-bottom: 8px;}

/* Utils */
.text-green { color: #34d399 !important; }
.text-red { color: #f87171 !important; }
.text-blue { color: #60a5fa !important; }
.text-violet { color: #a78bfa !important; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .care-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split-view { grid-template-columns: 1fr; height: auto; }
  .intelligence-map-container { height: 400px; }
}

@media (max-width: 768px) {
  .care-sidebar { transform: translateX(-100%); position: fixed; height: 100dvh;}
  .care-grid-2, .care-grid-3, .care-grid-4 { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; overflow-y: auto;}
  .kanban-column { flex: 0 0 auto; height: 400px;}
  .care-hero { flex-direction: column; text-align: center; padding: 40px 20px; }
  .hero-text h1 { font-size: 2rem;}
  .care-topbar { height: auto; padding: 12px 16px; flex-direction: column; gap: 8px; align-items: stretch; }
  .care-topbar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .care-btn { padding: 8px 6px; font-size: 0.7rem; justify-content: center; text-align: center; }
  .routing-flow { flex-direction: column; gap: 12px; padding: 16px; width: 100%; box-sizing: border-box; }
  .flow-arrow { transform: rotate(90deg); margin: 4px 0; }
  .flow-node { width: 100%; box-sizing: border-box; }
}
