/* ============================================================
   Historial de facturas (Macrodistribuidor)
   Usa las variables de tema (--primary, --secondary, ...) con
   valores por defecto para que funcione en cualquier tema.
   Prefijo: hf-
   ============================================================ */

/* ---------- Login del emisor ---------- */
.hf-login {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.hf-login__card {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    text-align: left;
}

.hf-login__hint {
    font-size: 0.85rem;
    color: #666;
    margin: 0.25rem 0 1rem;
}

/* ---------- Filtros ---------- */
.hf-filtros {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    text-align: left;
}

.hf-filtros__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.2rem;
}

/* ---------- Ingresos ---------- */
.hf-ingresos {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid #dde3ec;
    border-left: 4px solid var(--primary, #0551b3);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(5, 81, 179, 0.08);
    text-align: left;
}

.hf-ingresos__label {
    font-weight: 600;
    color: var(--primary, #0551b3);
    text-transform: capitalize;
}

.hf-ingresos__hint {
    font-size: 0.75rem;
    color: #777;
}

.hf-ingresos__valor {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.4rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ---------- Tabla ---------- */
.hf-tabla-wrap {
    width: 100%;
    overflow-x: auto;
    padding: 0.25rem 0.75rem 0.5rem;
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(5, 81, 179, 0.08);
}

.hf-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

    .hf-tabla thead th {
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: #555;
        border-bottom: 2px solid #dde3ec;
        white-space: nowrap;
    }

    .hf-tabla td {
        padding: 0.6rem 0.75rem;
        border-bottom: 1px solid #eef1f6;
        vertical-align: middle;
    }

.hf-tabla tbody tr:last-child td {
    border-bottom: none;
}

.hf-fila {
    cursor: pointer;
    transition: background-color 0.12s;
}

    .hf-fila:hover,
    .hf-fila--activa {
        background-color: #f3f7fd;
    }

.hf-derecha {
    text-align: right;
}

.hf-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.hf-cliente {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hf-chevron {
    color: #888;
}

/* ---------- Badges ---------- */
.hf-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.hf-badge--success { background: #d4edda; color: #1e6b32; }
.hf-badge--danger  { background: #f8d7da; color: #8a1f2b; }
.hf-badge--warning { background: #fff3cd; color: #7a5b00; }
.hf-badge--info    { background: #dbeafe; color: #0551b3; }
.hf-badge--accent  { background: #ede2fb; color: #5a2d99; }

/* ---------- Detalle expandido ---------- */
.hf-detalle-row td {
    background: #fafbfd;
    padding: 0;
}

.hf-detalle {
    padding: 1rem 1.25rem;
}

.hf-detalle__datos {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.hf-detalle__etiqueta {
    font-size: 0.75rem;
    color: #777;
}

.hf-detalle__valor {
    font-size: 0.8rem;
    word-break: break-all;
}

.hf-detalle__acciones {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.hf-detalle__acciones .btn-facturar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Alertas ---------- */
.hf-alerta {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.75rem 0;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.82rem;
    text-align: left;
}

.hf-alerta--error {
    background: #f8d7da;
    color: #8a1f2b;
}

/* ---------- Estado vacío / paginación ---------- */
.hf-vacio {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #777;
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(5, 81, 179, 0.08);
}

    .hf-vacio i {
        font-size: 2.2rem;
        display: block;
        margin-bottom: 0.4rem;
    }

.hf-vacio__titulo {
    font-weight: 600;
    color: #444;
}

.hf-mas {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .hf-filtros {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .hf-ingresos {
        flex-direction: column;
        align-items: flex-start;
    }

    /* La tabla se apila: cada fila es una tarjeta con la etiqueta de cada celda. */
    .hf-tabla thead {
        display: none;
    }

    .hf-tabla,
    .hf-tabla tbody,
    .hf-tabla tr,
    .hf-tabla td {
        display: block;
        width: 100%;
    }

    .hf-fila {
        padding: 0.5rem 0;
        border-bottom: 1px solid #dde3ec;
    }

        .hf-fila td {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            border-bottom: none;
            padding: 0.3rem 0.75rem;
            text-align: right;
        }

            .hf-fila td::before {
                content: attr(data-label);
                font-weight: 600;
                color: #555;
                text-align: left;
            }

            .hf-fila td.hf-chevron {
                display: none;
            }

    .hf-cliente {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .hf-filtros {
        grid-template-columns: 1fr;
    }
}
