/* =====================================================
   DASHBOARD - Estilos específicos del Dashboard
   ===================================================== */

/* ── Selector Global ── */
.global-selector {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.global-selector .custom-select {
    position: relative;
    z-index: 50;
}

.global-selector .custom-select.active {
    z-index: 100;
}

.global-selector .custom-select__options {
    max-height: 0;
    opacity: 0;
}

.global-selector .custom-select.active .custom-select__options {
    max-height: 280px;
}

/* ── Task Table ── */
.task-table-container {
    overflow: visible;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.task-table thead {
    background: var(--bg-elevated);
}

.task-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.task-table th:hover {
    color: var(--text-primary);
}

.task-table th .sort-icon {
    color: var(--text-muted);
    margin-left: var(--space-1);
    font-size: 10px;
}

.task-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.task-table tr {
    transition: background var(--transition-fast);
}

.task-table tbody tr:hover {
    background: var(--bg-hover);
}

.task-table tbody tr:last-child td {
    border-bottom: none;
}

/* Task row elements */
.task-title {
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.task-assignee__name {
    white-space: nowrap;
    color: var(--text-secondary);
}

.task-date {
    color: var(--text-secondary);
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.task-date--overdue {
    color: var(--flag-blocked);
}

.task-progress {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 120px;
}

.task-progress__value {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* ── Flag Filters ── */
.flag-filters {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.flag-filter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
}

.flag-filter:hover {
    border-color: var(--text-muted);
}

.flag-filter.active {
    border-color: currentColor;
}

.flag-filter--on-track.active {
    background: var(--flag-on-track-bg);
    color: var(--flag-on-track);
    border-color: var(--flag-on-track);
}

.flag-filter--in-process.active {
    background: var(--flag-in-process-bg);
    color: var(--flag-in-process);
    border-color: var(--flag-in-process);
}

.flag-filter--blocked.active {
    background: var(--flag-blocked-bg);
    color: var(--flag-blocked);
    border-color: var(--flag-blocked);
}

.flag-filter__count {
    font-family: var(--font-mono);
    opacity: 0.8;
}

/* ── KPI Charts Section ── */
.kpi-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.kpi-chart-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.kpi-chart-card__title {
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
}

.kpi-chart-card__canvas {
    width: 100%;
    min-height: 200px;
    position: relative;
}

/* ── Donut Chart ── */
.donut-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
}

.donut-chart__svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.donut-chart__circle {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
    transition: stroke-dasharray var(--transition-slow);
}

.donut-chart__background {
    stroke: var(--bg-elevated);
}

.donut-chart__value {
    position: absolute;
    font-family: var(--font-mono);
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
}

.donut-chart__legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.donut-chart__legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.donut-chart__legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Bar Chart ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    height: 180px;
    padding-top: var(--space-4);
}

.bar-chart__group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    height: 100%;
    justify-content: flex-end;
}

.bar-chart__bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.bar-chart__bar {
    width: 16px;
    border-radius: 3px 3px 0 0;
    transition: height var(--transition-slow);
    min-height: 4px;
    position: relative;
}

.bar-chart__bar--new {
    background: var(--accent);
}

.bar-chart__bar--completed {
    background: var(--flag-on-track);
}

.bar-chart__bar:hover {
    opacity: 0.85;
}

.bar-chart__label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-align: center;
    margin-top: var(--space-1);
}

.bar-chart__legend {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    margin-top: var(--space-3);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
}

.bar-chart__legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.bar-chart__legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* ── Horizontal Bar Chart (Workload) ── */
.hbar-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.hbar-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.hbar-row__label {
    width: 100px;
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.hbar-row__bar-wrapper {
    flex: 1;
    height: 20px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.hbar-row__bar {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow);
    display: flex;
    align-items: center;
    padding-left: var(--space-2);
}

.hbar-row__value {
    font-size: var(--fs-xs);
    font-family: var(--font-mono);
    color: var(--text-muted);
    min-width: 52px;
    text-align: right;
}

/* ── New Task Button ── */
.btn--new-task {
    background: var(--accent);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--transition-fast);
    font-family: var(--font-primary);
}

.btn--new-task:hover {
    background: var(--accent-hover);
    box-shadow: var(--accent-glow);
    transform: translateY(-1px);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    /* Task table: horizontal scroll */
    .task-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .task-table {
        min-width: 640px;
    }

    /* Donut chart: stack vertically */
    .donut-chart {
        flex-direction: column;
        gap: var(--space-4);
    }

    /* Reduce hbar label width */
    .hbar-row__label {
        width: 70px;
    }

    /* Flag filters wrap */
    .flag-filters {
        flex-wrap: wrap;
    }

    /* Global selector wraps */
    .global-selector {
        gap: var(--space-2);
    }
}