/* ============================================
   MUI-X Data Grid Styling
   ============================================ */

/* Table Container */
.mud-table-muix {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-table-lines);
    border-radius: 4px;
    overflow: hidden;
}

/* Remove MudBlazor default borders */
.mud-table-muix .mud-table-container {
    border: none;
}

/* Header Styling - Clean, minimal */
.mud-table-muix .mud-table-head {
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-table-lines);
}

.mud-table-muix .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--mud-palette-text-primary);
    padding: 16px;
    border-bottom: 1px solid var(--mud-palette-table-lines);
    border-right: none;
    background: transparent;
}

/* Column dividers - subtle */
.mud-table-muix .mud-table-head .mud-table-cell:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--mud-palette-divider-light);
    opacity: 0.3;
}

/* Body Rows */
.mud-table-muix .mud-table-body .mud-table-row {
    border-bottom: 1px solid var(--mud-palette-table-lines);
    transition: background-color 0.2s ease;
}

.mud-table-muix .mud-table-body .mud-table-row:last-child {
    border-bottom: none;
}

/* Hover State */
.mud-table-muix .mud-table-body .mud-table-row:hover {
    background-color: var(--mud-palette-action-default-hover);
}

/* Body Cells */
.mud-table-muix .mud-table-body .mud-table-cell {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--mud-palette-text-primary);
    border-right: none;
}

/* Footer Styling */
.mud-table-muix .mud-table-foot .mud-table-cell {
    border-top: 2px solid var(--mud-palette-table-lines);
    font-weight: 600;
    padding: 16px;
    background: var(--mud-palette-surface);
}

/* Sort Indicators - Refined */
.mud-table-muix .table-header {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.mud-table-muix .table-header:hover {
    color: var(--mud-palette-primary);
}

.mud-table-muix .table-header.active-sort {
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.mud-table-muix .sort-indicator {
    opacity: 0.7;
}

/* Dark Theme Adjustments */
.mud-theme-dark .mud-table-muix {
    border-color: rgba(255, 255, 255, 0.12);
}

.mud-theme-dark .mud-table-muix .mud-table-head .mud-table-cell {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.mud-theme-dark .mud-table-muix .mud-table-body .mud-table-row {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.mud-theme-dark .mud-table-muix .mud-table-body .mud-table-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.mud-theme-dark .mud-table-muix .mud-table-foot .mud-table-cell {
    border-top-color: rgba(255, 255, 255, 0.12);
}

/* ============================================
   Document Type Status Badges
   ============================================ */

.doc-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: lowercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Entrada (In) - Green */
.doc-type-entrada {
    background-color: rgba(46, 125, 50, 0.12);
    color: #2e7d32;
}

/* Salida (Out) - Blue */
.doc-type-salida {
    background-color: rgba(2, 136, 209, 0.12);
    color: #0288d1;
}

/* Default fallback */
.doc-type-default {
    background-color: rgba(158, 158, 158, 0.12);
    color: #616161;
}

/* Dark Theme Badges */
.mud-theme-dark .doc-type-entrada {
    background-color: rgba(76, 175, 80, 0.16);
    color: #81c784;
}

.mud-theme-dark .doc-type-salida {
    background-color: rgba(3, 169, 244, 0.16);
    color: #4fc3f7;
}

.mud-theme-dark .doc-type-default {
    background-color: rgba(189, 189, 189, 0.16);
    color: #bdbdbd;
}

/* Hover effect on parent row */
.mud-table-row:hover .doc-type-badge {
    filter: brightness(1.1);
}

/* ============================================
   Money Value Theming (MUI-X Style)
   ============================================ */

/* Positive values (salida/ventas) - Green background */
.money-value-positive {
    background-color: rgba(76, 175, 80, 0.12);
    color: #2e7d32;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: right;
}

/* Negative values (entrada) - Red background */
.money-value-negative {
    background-color: rgba(244, 67, 54, 0.12);
    color: #c62828;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: right;
}

/* Zero values - Gray background */
.money-value-zero {
    background-color: rgba(158, 158, 158, 0.12);
    color: #616161;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: right;
}

/* Dark Theme Money Values */
.mud-theme-dark .money-value-positive {
    background-color: rgba(76, 175, 80, 0.16);
    color: #81c784;
}

.mud-theme-dark .money-value-negative {
    background-color: rgba(244, 67, 54, 0.16);
    color: #ef5350;
}

.mud-theme-dark .money-value-zero {
    background-color: rgba(189, 189, 189, 0.16);
    color: #bdbdbd;
}
