/* Premium Analytics Dashboard */

.analytics-container {
  margin: 20px 0 60px;
}

/* ── Overview Cards ──────────────────────────────────────── */

.a-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

.a-card-overview {
  text-align: center;
  height: 100%;
  padding: 25px 15px;
}

.a-card-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a5276;
  line-height: 1.2;
}

.a-card-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 6px;
}

/* ── Card Header with Controls ──────────────────────────── */

.a-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.a-card-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.a-card-controls input {
  width: 200px;
  max-width: 100%;
}

/* ── Student Table ──────────────────────────────────────── */

.a-table {
  margin-bottom: 0;
}

.a-table thead th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 0.85rem;
  color: #555;
  border-bottom: 2px solid #ddd;
  padding: 10px 8px;
}

.a-table thead th:hover {
  color: #1a5276;
}

.a-table thead th i {
  margin-left: 4px;
  font-size: 0.75rem;
  opacity: 0.5;
}

.a-table thead th .fa-sort-asc,
.a-table thead th .fa-sort-desc {
  opacity: 1;
}

.a-table tbody td {
  padding: 10px 8px;
  vertical-align: middle;
  font-size: 0.9rem;
}

/* Score labels */
.label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}

.label-success {
  background: #4caf50;
}

.label-warning {
  background: #ff9800;
}

.label-danger {
  background: #f44336;
}

/* ── Pagination ─────────────────────────────────────────── */

.a-pagination {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.a-pagination .btn-group .btn {
  min-width: 30px;
  padding: 3px 8px;
}

/* ── Engagement Chart ──────────────────────────────────── */

.engagement-chart {
  overflow-x: auto;
  padding: 10px 0;
}

.engagement-chart svg text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Topic Breakdown ────────────────────────────────────── */

.topic-row {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.topic-row:last-child {
  border-bottom: none;
}

.topic-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.topic-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.topic-meta {
  font-size: 0.8rem;
  color: #888;
}

.topic-bar {
  height: 24px;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
}

.topic-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.topic-bar-label {
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ── Dark Mode ─────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  .a-card,
  .a-card-overview {
    background: #2c2c2c;
    border-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .a-card-value {
    color: #64b5f6;
  }

  .a-card-label,
  .topic-meta,
  .a-pagination small {
    color: #aaa;
  }

  .a-table thead th {
    color: #bbb;
    border-bottom-color: #555;
  }

  .a-table tbody td {
    color: #ddd;
    border-bottom-color: #444;
  }

  .a-pagination {
    border-top-color: #444;
  }

  .topic-info {
    color: #ddd;
  }

  .topic-row {
    border-bottom-color: #3a3a3a;
  }

  .topic-bar {
    background: #444;
  }

  .topic-name {
    color: #eee;
  }

  .engagement-chart svg text {
    fill: #bbb;
  }
}

/* ── Mobile ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .a-card-overview {
    padding: 18px 10px;
    margin-bottom: 15px;
  }

  .a-card-value {
    font-size: 1.6rem;
  }

  .a-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .a-card-controls input {
    width: 100%;
  }

  /* Hide table on mobile, show cards */
  .table-responsive {
    display: none;
  }

  .a-card-overview .a-card-label {
    font-size: 0.78rem;
  }
}
