/*
 * public/css/insights.css
 * AI Insights panel — shared across Teacher, Principal, and Parent dashboards.
 * Dark-theme by default (dark educator portals); parent portal uses light overrides.
 */

/* ── Panel container ──────────────────────────────────────────────────────── */

.insights-panel {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.insights-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.insights-title {
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.insights-subtitle {
  font-size: 12px;
  color: #64748b;
  flex: 1;
}

.insights-refresh-btn {
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #94a3b8;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
}

.insights-refresh-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.5);
}

/* ── Insights list ────────────────────────────────────────────────────────── */

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insights-loading {
  font-size: 13px;
  color: #64748b;
  padding: 8px 0;
  animation: pulse 1.8s ease-in-out infinite;
}

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

/* ── Individual insight card ──────────────────────────────────────────────── */

.insight-card {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 3px solid rgba(99, 102, 241, 0.4);
  transition: border-color 0.15s, background 0.15s;
  animation: slideInInsight 0.25s ease-out;
}

@keyframes slideInInsight {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Priority tinting */
.insight-card.insight-priority-1 {
  border-left-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.05);
}

.insight-card.insight-priority-2 {
  border-left-color: rgba(99, 102, 241, 0.5);
}

.insight-card.insight-priority-3 {
  border-left-color: rgba(100, 116, 139, 0.4);
}

.insight-card:hover {
  background: rgba(99, 102, 241, 0.06);
}

.insight-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.insight-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.insight-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 4px;
  line-height: 1.4;
}

.insight-card-body {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.insight-action-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #818cf8;
  text-decoration: none;
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 5px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: all 0.15s;
}

.insight-action-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}

.insight-dismiss {
  background: transparent;
  border: none;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.insight-dismiss:hover {
  color: #94a3b8;
}

/* ── Parent portal light overrides ───────────────────────────────────────── */

.p-portal-page .insights-panel {
  background: rgba(249, 250, 251, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.p-portal-page .insights-title {
  color: #1e293b;
}

.p-portal-page .insights-subtitle {
  color: #64748b;
}

.p-portal-page .insight-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.p-portal-page .insight-card.insight-priority-1 {
  background: rgba(254, 242, 242, 0.8);
  border-left-color: rgba(239, 68, 68, 0.4);
}

.p-portal-page .insight-card-title {
  color: #1e293b;
}

.p-portal-page .insight-card-body {
  color: #475569;
}

.p-portal-page .insights-loading {
  color: #94a3b8;
}

.p-portal-page .insights-refresh-btn {
  color: #64748b;
  border-color: rgba(99, 102, 241, 0.3);
}

.p-portal-page .insights-refresh-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
}

.p-portal-page .insight-dismiss {
  color: #cbd5e1;
}

.p-portal-page .insight-dismiss:hover {
  color: #94a3b8;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .insights-panel {
    padding: 14px 16px;
  }

  .insights-header {
    gap: 6px;
  }

  .insights-subtitle {
    display: none;
  }

  .insight-card {
    padding: 12px 12px;
  }

  .insight-icon {
    font-size: 17px;
  }
}
