/* ========================================
   Dashboard Widget Component
   Matches Status Overview design language
   ======================================== */

/* Grid layout - same as status-overview */
.dashboard-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 16px;
}

/* ========================================
   Single Value Widget (number, text, etc.)
   ======================================== */

.dashboard-widget {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding-inline: 16px;
    padding-block: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 72px;
    transition: all 0.2s ease;
}

/* Clickable widget */
.dashboard-widget.widget-clickable {
    cursor: pointer;
}

.dashboard-widget.widget-clickable:hover {
    background: var(--interactive-hover);
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Header (hidden for clean look, title shown below)
   ======================================== */

.dashboard-widget-header {
    display: none;
}

/* Dot menu - appears on hover at top-right */
.dashboard-widget-menu {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    opacity: 0;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
}

.dashboard-widget:hover .dashboard-widget-menu {
    opacity: 1;
}

.dashboard-widget-menu:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* ========================================
   Content - Clean centered display
   ======================================== */

.dashboard-widget-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Big number - same as status-card-count */
.dashboard-widget-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Column name - same as status-card-name */
.dashboard-widget-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

/* Subtitle (e.g., "3 empty") */
.dashboard-widget-subtitle {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
}

.dashboard-widget-subtitle:empty {
    display: none;
}

/* Title shown as label at bottom */
.dashboard-widget-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ========================================
   Relational Column Chips
   ======================================== */

.dashboard-widget-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
}

.dashboard-widget-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 11px;
    transition: all 0.15s ease;
}

.dashboard-widget-chip.has-color {
    border-inline-start: 3px solid var(--chip-color, var(--text-tertiary));
}

/* Hide empty chips for cleaner look */
.dashboard-widget-chip.chip-empty {
    display: none;
}

/* Show all chips on hover */
.dashboard-widget:hover .dashboard-widget-chip.chip-empty {
    display: inline-flex;
    opacity: 0.4;
}

.dashboard-widget-chip.chip-clickable {
    cursor: pointer;
}

.dashboard-widget-chip.chip-clickable:hover {
    background: var(--interactive-hover);
}

.chip-name {
    color: var(--text-secondary);
    white-space: nowrap;
}

.chip-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
    .dashboard-widgets-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 12px;
        padding: 12px;
    }

    .dashboard-widget {
        padding-inline: 12px;
        padding-block: 10px;
        min-height: 60px;
    }

    .dashboard-widget-value {
        font-size: 20px;
    }

    .dashboard-widget-title,
    .dashboard-widget-label {
        font-size: 12px;
    }
}
