/* ============================================================
   Analytics Shared Styles — ProTraxx
   Used by: Analytics.razor, SummarySurveyOrEvaluationAnalyticsDialog.razor,
            ResponseDistributionHeatmap, QuestionSummaryList
   Theme: MudBlazor CSS vars for theme-sensitive surfaces/text,
          fixed ProTraxx blue (#005aad→#0073E6) for column headers,
          color-mix(surface, #0073E6) for parent rows (auto light/dark),
          fixed hex only for data colors (greens) and white-on-dark text.
   ============================================================ */

/* ---- Collapsible section header ---- */

.analytics-section-header {
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.analytics-section-header:hover {
    background-color: var(--mud-palette-action-default-hover);
}

/* ---- Heatmap table ---- */

.analytics-heatmap {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    background: var(--mud-palette-surface);
}

/* Column headers — ProTraxx primary blue gradient, consistent in both light and dark themes. */
.analytics-heatmap th {
    background: linear-gradient(160deg,
        #005aad 0%,
        #0073E6 100%);
    color: #fff;
    padding: 11px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.analytics-heatmap th.analytics-question-header {
    text-align: left;
    min-width: 260px;
    max-width: 340px;
}

.analytics-heatmap th.analytics-choice-header {
    min-width: 110px;
}

/* Sortable choice headers */
.analytics-sortable {
    cursor: pointer;
    user-select: none;
    transition: filter 0.15s ease;
}

.analytics-sortable:hover {
    filter: brightness(1.25);
}

.analytics-sort-indicator {
    font-size: 0.65rem;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-block;
    opacity: 0.9;
}

/* All body cells */
.analytics-heatmap td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--mud-palette-divider);
    vertical-align: middle;
}

/* ---- Sticky question column ---- */

.analytics-question-cell {
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-weight: 500;
    font-size: 0.8125rem;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid var(--mud-palette-divider);
    transition: filter 0.15s ease;
}

/* Matrix parent row — blue-tinted surface: light mode ~#CCE0F8 (light blue), dark mode ~#2D3C52 (dark blue-tint). */
.analytics-parent-row .analytics-question-cell {
    background-color: color-mix(in srgb, var(--mud-palette-surface) 75%, #0073E6);
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    border-left: 4px solid #0073E6;
    letter-spacing: 0.1px;
}

/* Matrix child row — surface (not background) because PaletteDark.Background =
   Colors.Gray.Lighten1 = #bdbdbd (medium gray), which creates a gray slab in dark
   mode. Surface = #373740 is the correct dark table color. */
.analytics-child-row .analytics-question-cell {
    padding-left: 36px;
    background-color: var(--mud-palette-surface);
    border-left: 3px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-primary);
    font-weight: 400;
    font-size: 0.8rem;
}

/* Row hover */
.analytics-heatmap tbody tr:hover .analytics-question-cell {
    filter: brightness(0.91);
}

/* Clickable parent rows */
.analytics-parent-row {
    cursor: pointer;
}

/* ---- Data cells ---- */

.analytics-data-cell {
    text-align: center;
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.analytics-clickable:hover {
    transform: scale(1.07);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.32);
    z-index: 20;
    cursor: pointer;
}

/* Subtle inner highlight for colored (non-zero) cells — adds "shine" */
.analytics-data-cell:not(.analytics-empty-cell) {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Cell inner layout */
.analytics-cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.analytics-pct {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    line-height: 1.1;
}

.analytics-count {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
    line-height: 1.1;
}

/* Empty / zero-count cells:
   background is set inline (rgba neutral gray works in both themes).
   Use text-secondary (not text-disabled) — text-disabled is near-invisible
   in light mode (~38% opacity) while text-secondary remains readable. */
.analytics-empty-cell .analytics-pct,
.analytics-empty-cell .analytics-count {
    color: var(--mud-palette-text-secondary) !important;
    text-shadow: none !important;
    font-weight: 500 !important;
}

/* ---- Question summary list ---- */

.analytics-question-row {
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-divider);
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.analytics-question-row:hover {
    background-color: var(--mud-palette-action-default-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---- Utility ---- */

.full-width {
    width: 100%;
}
