/* ============================================================
   ESTILOS PARA REPORTES - Inventario TX
   ============================================================ */

/* ── TABLA DE REPORTES ─────────────────────────────────── */
.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-sm);
}

.report-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.report-table th {
    background: var(--gradient-hero);
    color: var(--color-header-text);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.report-table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.report-table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.report-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    transition: background var(--transition-fast);
}

.report-table tbody tr {
    animation: deslizar-entrada var(--transition-normal) both;
}

.report-table tbody tr:hover td {
    background: var(--color-primary-light);
}

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

/* ── RESUMEN DIARIO ────────────────────────────────────── */
.daily-summary {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--color-primary);
    transition: all var(--transition-normal);
    animation: deslizar-entrada var(--transition-normal) both;
}

.daily-summary:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
    border-left-color: var(--color-esmeralda);
}

.daily-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.daily-date {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-date i {
    color: var(--color-primary);
}

.daily-total {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-lg);
}

.daily-details {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
}

/* ── TOP PRODUCTOS ─────────────────────────────────────── */
.top-product {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--color-primary);
    transition: all var(--transition-fast);
    animation: deslizar-entrada var(--transition-normal) both;
}

.top-product:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
    border-left-color: var(--color-esmeralda);
}

.top-product:last-child {
    margin-bottom: 0;
}

.product-rank {
    background: var(--gradient-primary);
    color: white;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    animation: pulso 2s ease-in-out infinite;
}

.product-rank.rank-1 {
    background: var(--gradient-confirmar);
}

.product-rank.rank-2 {
    background: var(--gradient-primary);
}

.product-rank.rank-3 {
    background: var(--gradient-warning);
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-nombre {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: var(--font-size-sm);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-stats {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    display: flex;
    gap: 0.75rem;
}

.product-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.product-revenue {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-base);
    white-space: nowrap;
}

/* ── CHART PLACEHOLDER ─────────────────────────────────── */
.chart-container {
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-surface) 100%);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--color-border);
}

.chart-placeholder {
    color: var(--color-muted);
    font-size: var(--font-size-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.chart-placeholder i {
    font-size: 2.5rem;
    opacity: 0.4;
    animation: rebotar 2s ease-in-out infinite;
}

/* ── EMPTY REPORT ─────────────────────────────────────── */
.empty-report {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-muted);
}

.empty-report i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.2;
    animation: rebotar 2s ease-in-out infinite;
}

.empty-report p {
    font-size: var(--font-size-sm);
    max-width: 320px;
    margin: 0 auto;
}

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
    .report-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .daily-summary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .top-product {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .product-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .report-table th,
    .report-table td {
        padding: 0.625rem 0.75rem;
    }

    .daily-summary {
        padding: 0.875rem;
    }
}

/* ── BUSCADOR DE PRODUCTO ──────────────────────────────── */
.product-search-wrapper {
    position: relative;
}

.product-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
}

.product-dropdown.show {
    display: block;
    animation: deslizar-entrada var(--transition-fast) both;
}

.product-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.product-dropdown-item:last-child {
    border-bottom: none;
}

.product-dropdown-item:hover {
    background: var(--color-primary-light);
}

.product-dropdown-item .product-nombre {
    font-weight: 500;
    color: var(--color-text-heading);
    font-size: var(--font-size-sm);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-dropdown-item .product-precio {
    font-weight: 600;
    color: var(--color-esmeralda);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.product-dropdown-item .product-tipo {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    padding: 0.125rem 0.375rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.product-dropdown-item .badge-individual {
    background: var(--color-info-light);
    color: var(--color-info);
}

.product-dropdown-item .badge-paquete {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.product-selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ── TABLA AGRUPADA ─────────────────────────────────────── */
.agrupado-table {
    width: 100%;
    margin-bottom: 1.5rem;
}

.agrupado-table th {
    background: var(--color-header);
    color: var(--color-header-text);
    padding: 0.75rem 1rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agrupado-table th:last-child {
    text-align: right;
}

.agrupado-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.agrupado-table td:nth-child(2),
.agrupado-table td:nth-child(3),
.agrupado-table td:nth-child(4) {
    text-align: center;
}

.agrupado-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--color-esmeralda);
}

.agrupado-table tbody tr:hover td {
    background: var(--color-bg);
}

.agrupado-table .product-cell {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.agrupado-table .product-name {
    font-weight: 600;
    color: var(--color-text-heading);
}

.agrupado-table .product-type {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
}

.agrupado-table .qty-cell {
    text-align: center;
    font-weight: 600;
}

.agrupado-table .text-danger {
    color: var(--color-rubi) !important;
}

.agrupado-table .text-warning {
    color: var(--color-warning) !important;
}

/* ── BADGE SERVICIO (reportes) ───────────────────────────── */
.badge-servicio {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    display: inline-block;
}
.agrupado-table .empty-report {
    padding: 2rem;
}

.agrupado-table tfoot td {
    background: var(--color-bg);
    border-top: 2px solid var(--color-border);
}

/* ── FILTROS AVANZADOS ─────────────────────────────────── */
.filter-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--color-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.filter-divider::before,
.filter-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.filter-divider span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

#filtrosAvanzados .form-label {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#filtrosAvanzados .collapse {
    transition: all var(--transition-normal);
}

#filtrosAvanzados .row {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ── UTILIDADES ────────────────────────────────────────── */
.text-danger {
    color: var(--color-rubi) !important;
}

.text-warning {
    color: var(--color-warning) !important;
}

/* ── SEGMENTED CONTROL (selector de modo) ─────────────── */
.modo-control {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--color-bg);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.modo-control-btn {
    flex: 1 1 180px;
    background: transparent;
    border: 1px solid transparent;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.modo-control-btn:hover {
    background: var(--color-surface);
    color: var(--color-text-heading);
}

.modo-control-btn.active {
    background: var(--gradient-hero);
    color: var(--color-header-text);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.modo-control-btn i {
    font-size: 1rem;
}

/* ── DEPARTAMENTO CARD ─────────────────────────────────── */
.depto-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--color-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-fast);
    animation: deslizar-entrada var(--transition-normal) both;
}

.depto-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
    border-left-color: var(--color-esmeralda);
}

.depto-card.servicios {
    border-left-color: #7c3aed;
}

.depto-info {
    flex: 1;
    min-width: 0;
}

.depto-nombre {
    font-weight: 700;
    color: var(--color-text-heading);
    font-size: var(--font-size-base);
    margin-bottom: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.depto-meta {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
}

.depto-total {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-lg);
    white-space: nowrap;
}

.depto-porcentaje {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    font-weight: 600;
}

/* ── BARRA DE PROGRESO PARA PORCENTAJES ──────────────── */
.depto-bar {
    background: var(--color-surface);
    height: 6px;
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.depto-bar-fill {
    height: 100%;
    background: var(--gradient-confirmar);
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.depto-bar-fill.servicios {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

/* ── MODO HEADER ─────────────────────────────────────── */
.modo-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
}

.modo-header-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-hero);
    color: var(--color-header-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.modo-header-info h4 {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--color-text-heading);
    font-weight: 700;
}

.modo-header-info p {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--color-muted);
}

/* ── SERVICIO ITEM (reporte servicio/producto) ───────── */
.serv-prod-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--color-primary);
    transition: all var(--transition-fast);
    animation: deslizar-entrada var(--transition-normal) both;
}

.serv-prod-row:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.serv-prod-row.tipo-servicio {
    border-left-color: #7c3aed;
}

.serv-prod-row.tipo-paquete {
    border-left-color: var(--color-warning);
}

.serv-prod-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: var(--font-size-sm);
}

.serv-prod-meta {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    margin-top: 2px;
}

.serv-prod-cant {
    background: var(--gradient-primary);
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    white-space: nowrap;
}

.serv-prod-total {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-base);
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}
