/**
 * HeuriSight Dashboard Layout
 * Based on: mockups/apple-redesign/02-learning-dashboard.html
 * 
 * Provides styling for:
 * - Dashboard grid layout
 * - Stat cards
 * - Chart areas
 * - Progress rings
 * - Competency lists
 * - Risk tables
 */

/* =============================================================================
   DASHBOARD CONTAINER
   ============================================================================= */

.hs-dashboard {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6, 24px);
    background: var(--bg-secondary, #F5F5F7);
}

.hs-dashboard__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6, 24px);
}

.hs-dashboard__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl, 24px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary, #1D1D1F);
}

.hs-dashboard__controls {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

/* =============================================================================
   DASHBOARD GRID
   ============================================================================= */

.hs-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-4, 16px);
    max-width: 1400px;
}

/* Column spans */
.hs-col-12 { grid-column: span 12; }
.hs-col-8 { grid-column: span 8; }
.hs-col-6 { grid-column: span 6; }
.hs-col-4 { grid-column: span 4; }
.hs-col-3 { grid-column: span 3; }

/* =============================================================================
   STATS ROW
   ============================================================================= */

.hs-stats-row {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4, 16px);
}

.hs-stat-card {
    background: var(--bg-primary, #FFFFFF);
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-5, 20px);
    box-shadow: var(--shadow-sm);
}

.hs-stat-card__label {
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary, #86868B);
    margin-bottom: var(--space-2, 8px);
}

.hs-stat-card__value {
    font-family: var(--font-display);
    font-size: var(--text-4xl, 34px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text-primary, #1D1D1F);
}

.hs-stat-card__value--success { color: var(--success, #34C759); }
.hs-stat-card__value--warning { color: var(--warning, #FF9500); }
.hs-stat-card__value--destructive { color: var(--destructive, #FF3B30); }
.hs-stat-card__value--accent { color: var(--accent, #0071E3); }

.hs-stat-card__change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-2, 8px);
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    color: var(--text-tertiary, #86868B);
}

.hs-stat-card__change--positive { color: var(--success, #34C759); }
.hs-stat-card__change--negative { color: var(--destructive, #FF3B30); }

.hs-stat-card__change svg {
    width: 12px;
    height: 12px;
}

/* =============================================================================
   CARDS
   ============================================================================= */

.hs-card {
    background: var(--bg-primary, #FFFFFF);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.hs-card__header {
    padding: var(--space-4, 16px) var(--space-5, 20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
}

.hs-card__title {
    font-size: var(--text-base, 15px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
}

.hs-card__action {
    font-size: var(--text-sm, 13px);
    font-weight: 500;
    color: var(--accent, #0071E3);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.hs-card__action:hover {
    text-decoration: underline;
}

.hs-card__body {
    padding: var(--space-5, 20px);
}

.hs-card__footer {
    padding: var(--space-4, 16px) var(--space-5, 20px);
    border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    background: var(--bg-tertiary, #FAFAFA);
}

/* =============================================================================
   CHART AREA
   ============================================================================= */

.hs-chart-area {
    height: 280px;
    background: linear-gradient(180deg, var(--bg-secondary, #F5F5F7) 0%, transparent 100%);
    border-radius: var(--radius-md, 12px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-4, 16px);
    position: relative;
    overflow: hidden;
}

.hs-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2, 8px);
    height: 200px;
}

.hs-chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
}

.hs-chart-bar {
    width: 20px;
    border-radius: 4px 4px 0 0;
    transition: height var(--duration-normal, 250ms) var(--ease-default);
}

.hs-chart-bar--mastery { background: var(--success, #34C759); }
.hs-chart-bar--pass { background: var(--accent, #0071E3); }
.hs-chart-bar--reassess { background: var(--destructive, #FF3B30); opacity: 0.7; }

.hs-chart-bar-label {
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.hs-chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-6, 24px);
    padding-top: var(--space-4, 16px);
    border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    margin-top: var(--space-4, 16px);
}

.hs-chart-legend__item {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    font-size: var(--text-sm, 13px);
    color: var(--text-secondary, #6E6E73);
}

.hs-chart-legend__dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full, 9999px);
}

.hs-chart-legend__dot--mastery { background: var(--success, #34C759); }
.hs-chart-legend__dot--pass { background: var(--accent, #0071E3); }
.hs-chart-legend__dot--reassess { background: var(--destructive, #FF3B30); opacity: 0.7; }

/* =============================================================================
   PROGRESS RING
   ============================================================================= */

.hs-progress-ring {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-4, 16px);
}

.hs-progress-ring__container {
    width: 140px;
    height: 140px;
    position: relative;
}

.hs-progress-ring__svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.hs-progress-ring__bg {
    fill: none;
    stroke: var(--bg-secondary, #F5F5F7);
    stroke-width: 10;
}

.hs-progress-ring__progress {
    fill: none;
    stroke: var(--success, #34C759);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--duration-normal, 250ms) var(--ease-default);
}

.hs-progress-ring__value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hs-progress-ring__number {
    font-family: var(--font-display);
    font-size: var(--text-3xl, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--success, #34C759);
}

.hs-progress-ring__label {
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
}

/* =============================================================================
   COMPETENCY LIST
   ============================================================================= */

.hs-competency-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
}

.hs-competency-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

.hs-competency-item__name {
    flex: 1;
    font-size: var(--text-sm, 13px);
    color: var(--text-primary, #1D1D1F);
}

.hs-competency-item__value {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    width: 40px;
    text-align: right;
}

.hs-competency-item__bar {
    width: 80px;
    height: 6px;
    background: var(--bg-secondary, #F5F5F7);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}

.hs-competency-item__fill {
    height: 100%;
    border-radius: var(--radius-full, 9999px);
    transition: width var(--duration-normal, 250ms) var(--ease-default);
}

/* =============================================================================
   DATA TABLE
   ============================================================================= */

.hs-table-container {
    overflow-x: auto;
}

.hs-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm, 13px);
}

.hs-data-table th {
    text-align: left;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    font-weight: 500;
    color: var(--text-tertiary, #86868B);
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    white-space: nowrap;
}

.hs-data-table td {
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    color: var(--text-primary, #1D1D1F);
}

.hs-data-table tbody tr:hover {
    background: var(--bg-tertiary, #FAFAFA);
}

.hs-table-student {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

.hs-table-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full, 9999px);
    background: var(--bg-secondary, #F5F5F7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs, 11px);
    font-weight: 600;
    color: var(--text-secondary, #6E6E73);
}

/* Risk badges */
.hs-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full, 9999px);
    font-size: var(--text-xs, 11px);
    font-weight: 600;
}

.hs-risk-badge--high {
    background: var(--destructive-subtle, rgba(255, 59, 48, 0.12));
    color: var(--destructive, #FF3B30);
}

.hs-risk-badge--medium {
    background: var(--warning-subtle, rgba(255, 149, 0, 0.12));
    color: var(--warning, #FF9500);
}

.hs-risk-badge--low {
    background: var(--success-subtle, rgba(52, 199, 89, 0.12));
    color: var(--success, #34C759);
}

/* Progress bar in table */
.hs-table-progress {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-table-progress__bar {
    height: 6px;
    background: var(--bg-secondary, #F5F5F7);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
    width: 100px;
}

.hs-table-progress__fill {
    height: 100%;
    border-radius: var(--radius-full, 9999px);
}

.hs-table-progress__fill--success { background: var(--success, #34C759); }
.hs-table-progress__fill--warning { background: var(--warning, #FF9500); }
.hs-table-progress__fill--danger { background: var(--destructive, #FF3B30); }

.hs-table-progress__value {
    font-family: var(--font-mono, monospace);
    font-size: var(--text-sm, 13px);
    min-width: 32px;
}

/* Action button */
.hs-action-btn {
    padding: var(--space-1, 4px) var(--space-3, 12px);
    background: var(--bg-secondary, #F5F5F7);
    border: none;
    border-radius: var(--radius-sm, 6px);
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    color: var(--text-secondary, #6E6E73);
    cursor: pointer;
    transition: all var(--duration-fast, 150ms) var(--ease-default);
}

.hs-action-btn:hover {
    background: var(--border-light, rgba(0, 0, 0, 0.06));
    color: var(--text-primary, #1D1D1F);
}

/* =============================================================================
   SELECT TRIGGER
   ============================================================================= */

.hs-select-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: var(--bg-secondary, #F5F5F7);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    border-radius: var(--radius-sm, 6px);
    font-size: var(--text-sm, 13px);
    font-weight: 500;
    color: var(--text-primary, #1D1D1F);
    cursor: pointer;
    transition: all var(--duration-fast, 150ms) var(--ease-default);
}

.hs-select-trigger:hover {
    border-color: var(--border-default, rgba(0, 0, 0, 0.1));
}

.hs-select-trigger svg {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary, #86868B);
}

/* =============================================================================
   DARK THEME
   ============================================================================= */

[data-theme="dark"] .hs-dashboard {
    background: var(--bg-primary, #1C1C1E);
}

[data-theme="dark"] .hs-stat-card,
[data-theme="dark"] .hs-card {
    background: var(--bg-secondary, #2C2C2E);
}

[data-theme="dark"] .hs-chart-area {
    background: linear-gradient(180deg, var(--bg-tertiary, #3A3A3C) 0%, transparent 100%);
}

[data-theme="dark"] .hs-data-table tbody tr:hover {
    background: var(--bg-tertiary, #3A3A3C);
}

[data-theme="dark"] .hs-select-trigger,
[data-theme="dark"] .hs-action-btn {
    background: var(--bg-tertiary, #3A3A3C);
    border-color: var(--border-light, rgba(255, 255, 255, 0.08));
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 1200px) {
    .hs-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hs-col-8 { grid-column: span 12; }
    .hs-col-4 { grid-column: span 12; }
}

@media (max-width: 768px) {
    .hs-dashboard {
        padding: var(--space-4, 16px);
    }
    
    .hs-stats-row {
        grid-template-columns: 1fr;
    }
    
    .hs-dashboard__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3, 12px);
    }
    
    .hs-dashboard__controls {
        width: 100%;
        flex-wrap: wrap;
    }
}
